• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 650
  • Last Modified:

How to print the lines between two line numbers in unix

How to print the lines between two line numbers in unix ? I want this to be implemented in the script.
0
kranthi_50404
Asked:
kranthi_50404
1 Solution
 
sunnycoderCommented:
sed -n '2,6p'  inputfile

2 is the start line no and 6 is the end line no
0
 
saurabhpendharkerCommented:
Hello,
perl -ne 'print if 3 .. 5' input.txt  (To read lines between 3 and 5 line numbers in input.txt)
0

Featured Post

Keep up with what's happening at Experts Exchange!

Sign up to receive Decoded, a new monthly digest with product updates, feature release info, continuing education opportunities, and more.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now