Re: reducing redundant lines, partially

"Thierry Blanc [email protected] [sed-users]" <[email protected]> Sun, 20 Nov 2016 19:58:59 +0300
Newsgroups gmane.editors.sed.user
Message-ID <[email protected]>
Usually I am not good with N;P;D. I guess it is the political
connotation ...

sed -rf sedscript file

sedscript
:eep;
N;
s|*^*([^:]*):([^\n]*)\n\1|\1:\2|;
teep;
P;D

The 3. line: s|^
Why is the ^ needed?


On 20/11/16 19:05, Thierry Blanc [email protected] [sed-users] wrote:
> I have the output of a script in the form
>
> file1/full/path:<number>
>
> file1/full/path:<number>
>
> ....
>
> file2/full/path:<number>
>
> I want the output
>
> file1/full/path:<number>:<number> ...file2/full/path:<number>:<number> ...
>
> there might be one or many lines with the same file name.
>
> /home/Journal21/weltsicherheitsrat-uneins.html:9
> /home/Journal21/wenig-hoffnung-auf-ein-kriegsende.html:0
> /home//Journal21/wenig-hoffnung-auf-ein-kriegsende.html:9
> /home/Journal21/wenn-tote-zu-statistiken-werden.html:20
>
>
>
>
>
> [Non-text portions of this message have been removed]
>
>
>
> ------------------------------------
> Posted by: Thierry Blanc <[email protected]>
> ------------------------------------
>



[Non-text portions of this message have been removed]