Print lines in Bash.
Some tips for print lines in Bash.
print first few n lines
head -n n file
awk 'FNR <= n' file
sed -e nq file
sed nq file
print last few n lines
tail -n n file
print a specific line
sed -n 'np' file
print a range of lines n to m
sed -n 'n,mp' file
Written by Chao YANG
Related protips
Have a fresh tip? Share with Coderwall community!
Post
Post a tip
Best
#Shell
Authors
Related Tags
#shell
Sponsored by #native_company# — Learn More
#native_title#
#native_desc#