Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR SHELL

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
Source by www.quora.com #
 
PREVIOUS NEXT
Tagged: #command #display #line #file
ADD COMMENT
Topic
Name
3+6 =