Programming and Scripting :: Searching for a command...



Is there any simple way to read a single line from a file?
Like command cat but just one line.

Example: command <line_number>

Using awk...

For example to read/print the third line of the .filetool.lst file use:

awk 'NR = 3' .filetool.lst

Where NR is an internal variable of awk and is the number of records seen so far,

For some reason that doesn't work for me.

What does work for me is grep -m3 ^ .filetool.lst|tail -1
or head -3 .filetool.lst|tail -1
sed would probably work too, but i don't know how.

Make sure you use two equal signs and not one

awk 'NR == 3' .filetool.lst

Thank really much guys. This really helped me. :)

*starts to write his script*

Next Page...
original here.