I want to use sed
to give me some lines from a file. I want to extract these lines only within some part of the file, which I know. E.g. I have a file with 100 lines, and I am seeking for lines withing line 10 and 30 with a specific pattern.
My current solution is to use two sed
commands: The first prints every thing between the line numbers I have, e.g.
sed -n "10,30p" target_file.file
The second searches withing that result with a pattern
sed -n '/pattern/p'
So in the end I have this:
sed -n "10,30p" target_file.file | sed -n '/pattern/p'
Is there a way, to make one command out of two ?