Useful sed commands

· 32 Words
shell

Delete nth line inplace

sed -i .tmp '<n>d' <filename>

Get the nth line

sed '<n>q;d' <filename>

Delete the first 10 lines of a file

sed '1,10d'

Delete lines matching pattern

 sed '/pattern/d'