first four lines using awk

HBA Port WWN: 210000e08b1feade
OS Device Name: /dev/cfg/c11
Manufacturer: QLogic Corp.
Model: 375-3108-xx
Firmware Version: 3.3.120
FCode/BIOS Version: fcode: 1.13;
Type: N-port
State: online
Supported Speeds: 1Gb 2Gb
Current Speed: 2Gb
Node WWN: 200000e08b1feade

i am trying to print out the first four lines using awk. How can i do this?

awk 'NR<5' filename

Of course, you can use just head ...

thanks, that worked great!

better :wink:

awk '{ if ( NR < 5 ) { print } else { exit } }' filename

True,
or :slight_smile:

awk 'NR>4{exit}1' filename