tags:

views:

106

answers:

4

Hello,

i need a 1liner to remove the first 5 chars on any line of a text file, but i dont know sed, could anyone help me please?

Thanks in advance

Chris

+5  A: 
sed 's/^.\{,5\}//' file.dat
Ignacio Vazquez-Abrams
+11  A: 

Use cut:

cut -c6-

This prints each line of the input starting at column 6 (the first column is 1).

Greg Hewgill
+2  A: 
awk '{print substr($0,6)}' file
A: 
sed 's/^.....//'

means

replace ("s", substitute) beginning-of-line then 5 characters (".") with nothing.

There are more compact or flexible ways to write this using sed or cut.

Phil