I tried the following code unsuccessfully after using ls -1
awk -F '\n' '{ print $1 }'
How can I get the first row in terminal?
I tried the following code unsuccessfully after using ls -1
awk -F '\n' '{ print $1 }'
How can I get the first row in terminal?
head -n 1
Might be easier.
If you insist on awk, do
awk 'NR == 1 { print }'
awk '{print $0 ; exit(0); }'
I agree that head -1
is easier.
Other option:
sed q file