3

Example:

...
Line
some text
other text
10
...

Is it possible to tell GREP ^Line.*?^10$ so that dot matches also newline and I get this output:

Line
some text
other text
10

If not, is there some Linux CLI tool that can do it?

zetah
  • 2,981
  • 5
  • 19
  • 12

2 Answers2

5

If your intend is to output lines between, and including, Line and 10, I suggest to use awk:

awk '/^Line$/,/^10$/' myfile
mouviciel
  • 66,855
  • 13
  • 106
  • 140
0

Use sed:

sed -rn '/^Line$/,/^10$/p' filename
Starx
  • 77,474
  • 47
  • 185
  • 261
Stefan van den Akker
  • 6,661
  • 7
  • 48
  • 63