sed and its hold buffer????????
/\/$/d
s/[\*\=\@\|]$//
s/^\.\//\//
s/^\.:/\//
s/:$//
:loop
/^\/.*$/,/^$/ {
/^$/! {
$! {
/^\/.*$/ {
h
bloop
}
/^\/.*$/!s/^\/.*$/G&/ < ========== line in question
}
}
}
I know that this is not the right syntax; but this is the idea:
I want be able to grab the first line in a block of lines and pre append it to all the rest of the lines in the block. The file at the point of :loop has blocks of lines that start with / as the first character in the first line of the block and end the block with a blank line.
Sample data in text file
/this is the first line
the second
the third
the forth
< ===== blank line end of block
to end up with after sed runs its script file
/this is the first line
/this is the first line the second
/this is the first line the third
/this is the first line the forth
< ===== blank line end of block
PS the space inserted between line and the is intended.
|