Re: reducing redundant lines, partially
| Newsgroups | gmane.editors.sed.user |
|---|---|
| Message-ID | <CAEE75_09fEhcVn_e6tfU8aiRN_T8a4DzubX-2mDff2YpkagkYw@mail.gmail.com> |
On Sun, Nov 20, 2016 at 8:05 AM, Thierry Blanc [email protected] [sed-users] <[email protected]> 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. #!/bin/sed -Ef :a N s/(([^:\n]*)[^\n]*)\n\2(:.*)/\1\3/ ta P D gets you all the `:number`s for a sequence appended on a single line, did you want just the endpoints? I'd do that with a pair of subs before the `P`.