Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to remove the first x characters of each line in a text file? [closed]

I have a text file where I want to remove the first 6 characters of every line. The characters are whitespace and some numbers. They are ascii characters. How can this be done? I have a windows environment.

Example file:

54863 important text line 1
14247 important text line 2
29751 important text line 3

Example result:

important text line 1
important text line 2
important text line 3
like image 723
wolfgang mrazek Avatar asked Feb 22 '23 03:02

wolfgang mrazek


2 Answers

You could do this in any text-editor that supports regular expressions (notepad++ is windows and its free)

A simple expression for find and replace would be

^......

Which would match the first six character of each line. Obviously you can replace with "" nothing.

like image 170
Fraser Avatar answered Mar 05 '23 15:03

Fraser


Grab yourself Notepad++ (e.g. from www.portableapps.com), make a rectangular selection over the first six characters end press DEL. To make a rectangular selection hold ALT and drag with left mouse button clicked.

like image 35
Ocaso Protal Avatar answered Mar 05 '23 17:03

Ocaso Protal