You will find most of this in the links I gave you..
For example, this will
not work:
Code:
sed -n '10000,+19p s/orig/new'
the fundamental sed syntax is:
[flags] [address] command
within this, some commands allow additional commands to be added "where they make sense".
These are legal:
Code:
sed -n '10000,+19s/orig/new/'
sed -n '10000,+19p'
sed -n '10000,+19s/orig/new/p'
Beyond this, the best way to get your head around it is to try different things to see what happens.
Quote:
sed seems to hang after displaying select lines. I have to cntrl-c to break out of it. What is happening here?
|
If it's a long file, perhaps it just takes time to get thru it? You can quit after the selected lines like so:
prints lines 2 thru 6, then quits on line 7.
Quote:
2) Can one print line numbers before the output?
|
Yes