[problem]
You want to extract a specific line number from a file.
[/problem]
[solution]
Once you have your line number – see previous post on grep, we can extract lines around the pattern.
To do this sed (stream editor) can be used to print just desired lines – this says don’t print all lines (-n); start at line 456 and finish at line 466 – print:
sed -n 456,466p filename
[/solution]
[example]
Also with sed, we can say delete specific lines – in this case remove lines 5 to 10:
sed 5,10d filename
That’s not all sed can accept patterns, as start/end identifiers:
sed /start_pattern/,/end_pattern/d filename
[/example]
[reference]
[tags], Unix Coding School[/tags]
[/reference]