-2

For example:how can I print specific lines of a .txt file between line 5 and line 8 using only tail and head

Jonathan Leffler
  • 730,956
  • 141
  • 904
  • 1,278
lambozsolty
  • 81
  • 10

1 Answers1

0

Copied from here

infile.txt contains a numerical value on each line.

➜   X=3
➜   Y=10
➜   < infile.txt tail -n +"$X" | head -n "$((Y - X))"
3
4
5
6
7
8
9
➜  
Kevin C
  • 4,851
  • 8
  • 30
  • 64