hi group!
i have a huge text file with lines that llok like that:
123456 blahblahbla moreblahblahblah andsoon
123456 blahblahbla moreblahblahblah andsoon
123456 blahblahbla moreblahblahblah andsoon
123456 blahblahbla moreblahblahblah andsoon
123456 blahblahbla moreblahblahblah andsoon
(of course the lines differ :)
somethimes in that textfiles ther are errors, there are sometimes
newlines there that should not be, like this:
123456 blahblahbla moreblahblahblah andsoon
123456 blahblahbla moreblah
blahblah andsoon
123456 blahblahbla moreblahblahblah andsoon
123456 blahblahbla moreblahblahblah andsoon
123456 blahblahbla moreblahblahblah andsoon
what i want now is a sed script, that does the following:
if a line starts with a letter or parenthesis, join it with the
preceeding line. i have managed to do so with this example:
cat test| sed -e :a -e '$!N;s/\n[A-Za-z\(\)]//;ta' -e "P;D"
but the problem is that this deletes the first letter of the wrong row
because of
s/\n[A-Za-z\(\)]//
.
so this:
123456 blahblahbla moreblah
blahblah andsoon
results in:
123456 blahblahbla moreblahlahblah andsoon
^^
there should be a "b"
can i somehow preserve that letter or paste what was deleted but
without the preceeding newline?
big thanks in advance!!