Jul 24, 2008

Want to read Nth Line from the file

1. cat "filename"perl -ne 'print if($.==4)'
1. cat "filename" perl -ne 'print if($.==4)'
2. cat "filename" perl -ne '$.-4print'
3. cat "filename" awk '(NR==4){print}'
but if you want to have the line no. in variable then....
4. kk=5
head -$kk "filename" tail -1

No comments: