tags:

views:

304

answers:

2

I tried the following code unsuccessfully after using ls -1

awk -F '\n' '{ print $1 }'

How can I get the first row in terminal?

+2  A: 

head -n 1

Might be easier.

If you insist on awk, do

awk 'NR == 1 { print }'

Leonard
+1  A: 
awk '{print $0 ; exit(0); }'

I agree that head -1 is easier.

Other option:

sed q file
Charlie Martin
Thank you! The sed command is useful.
Masi