Question : displays the third line of the file
Answered by : chris-nzokaokoye
# Take the last line of the top three lines
head -n 3 my.txt | tail -n 1
# Tell sed to "be quiet", and print just the third line
sed -n 3p my.txt
# Tell sed to delete everything except the third line
sed '3!d' my.txt
# Tell awk to print the third input record of the current file
awk 'FNR==3 {print}' my.txt
Source : https://www.quora.com/How-can-I-print-only-the-third-line-of-a-file-with-UNIX | Last Update : Mon, 14 Mar 22