Answers for "command to display the 3rd line of a file"

0

command to display the 3rd line of a file

# 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
Posted by: Guest on March-07-2022

Code answers related to "command to display the 3rd line of a file"

Code answers related to "Shell/Bash"

Browse Popular Code Answers by Language