Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR SHELL

how to display specific lines from a file in linux

Write a bash script to print a particular line from a file:

awk = $ awk '{if(NR==LINE_NUMBER) print $0}' file.txt
sed = $ sed -n LINE_NUMBERp file.txt
 
PREVIOUS NEXT
Tagged: #display #specific #lines #file #linux
ADD COMMENT
Topic
Name
2+5 =