31 July 2011

print line n of a file with sed -n 'n{p;q}' file

$ cat jack_and_jill
jack and jill
went up the hill
to fetch
a pail of water
jack fell down
and broke his crown
and jill came tumbling after
$ sed -n '4{p;q}' jack_and_jill
a pail of water

No comments:

Post a Comment

Pages