Wednesday, April 18, 2012

SED - display text on specific line of text file

# print line number 52
sed -n '52p' # method 1
sed '52!d' # method 2
sed '52q;d' # method 3, efficient on large files 


sed -n '52,60 p' file # display line from 52 to 60

more +4 file # display line from 4 to the end

or

tail -n +2 file # display line from 2 to the end

No comments:

Post a Comment