Wednesday, August 8, 2012

How could you read/display the nth line of a file?

head -n <File Name> | tail -1
or
sed 'nq;d' <File Name>
or
awk 'NR==<Line No.> { print $0; exit }' <File Name>

No comments :