Linux - Awk command to print specific line from a file, Use conditional statement on command line

Awk command to print specific line from a file

awk command to print specific line from a file
  $  awk 'FNR==3' <file>

Use conditional statement on command line
  $  awk '{if (NR == 3) print}' <file>

Both the above commands will print the third line from the specified file.

Sed command to get a specified line
  $  sed -n 3p <file>

All the above command will give you the same output.

The topic on Linux - Awk command to print specific line from a file is posted by - Veen

Hope you have enjoyed, Linux - Awk command to print specific line from a fileThanks for your time

Tech Bluff