Quote:
Originally Posted by
scriptor
Hi Rudic
you suggestion works
Thank you.
Quote:
. . . in this can you please explain the working of below part.
Explaining
sed's intricate operation in depth exceeds my language capabilities as well probably space provided in here; on top, there's many texts on the topic in them there internet sites... once you're finished reading
sed's man and / or info pages as the principle sources of information.
In short,
sed has a pattern space and a hold space; on the former all commands operate upon, the latter is only copied and / or appended to / from, or exchanged. The commands can be influenced by (ranges of) addresses, which themselves can be regex (important:
man regex!) matches like
/pattern/ (
/^1/ matches a char "1" in the first place of a line) or line numbers (1 is the first line in an input stream). Don't mix up the two! The most powerful
sed command is
s(ubstitute):
s/\n//g globally
substitutes the regex pattern
\n (escape sequence interpreted as a <new line> char) with the empty string, effectively removing it.
Quote:
. . . also I will be grateful to your if suggest me how should I also learnt or understand so that I can too build similar 1 line coding . . .
L1 - reading - exercise - reading - exercise - goto L1