hey everybody,
I just wanted to know how I can print out with awk or others only one line and not a whole column what is made by print$1. I have a data which contains 205 lines and I want for example only the 6th line. I tried with this

BEGIN { RS = "" ; FS = "\n" }
{print $6}

...but it says

awk: record `TITLE = "title"
V...' too long

What's wrong with that. thanks a lot.

Hi!

You can choose the line number by using the variable NR.
To print the whole 6th line:

awk 'NR == 6 {print}' file.dat

To print the 6th column of the 6th line:

awk 'NR == 6 {print $6}' file.dat

Hope this is what you wanted.

Regards, mawe

Hi!

You can choose the line number by using the variable NR.
To print the whole 6th line:

awk 'NR == 6 {print}' file.dat

To print the 6th column of the 6th line:

awk 'NR == 6 {print $6}' file.dat

Hope this is what you wanted.

Regards, mawe

Hi, mawe

thanks a lot, it's exactly what I was searching for. It's simply syntax but it is nowhere described.

Regards, fili

This question has already been answered. Start a new discussion instead.