RenMcCourtey has asked for the wisdom of the Perl Monks concerning the following question:
Hi, I just hit the issue somewhere I wouldn't expect it. Let's say I want to remove new lines from file, but only some of them. It's obvious to me how to get rid of them all, and it's also what is described everywhere. But while it's easy to replace all Us with Os and all new lines with 'bla', how do I remove new lines from lines starting with U only? I tried following without any success:
perl -pe 's/\nU/U/g' /tmp/nejms.txt perl -pe 's/^U/U/g' /tmp/nejms.txt
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Remove SOME new lines
by hippo (Archbishop) on Jun 29, 2016 at 09:28 UTC | |
by RenMcCourtey (Acolyte) on Jun 29, 2016 at 09:35 UTC | |
|
Re: Remove SOME new lines
by haukex (Archbishop) on Jun 29, 2016 at 09:29 UTC | |
|
Re: Remove SOME new lines
by BrowserUk (Patriarch) on Jun 29, 2016 at 09:30 UTC | |
|
Re: Remove SOME new lines
by RenMcCourtey (Acolyte) on Jun 29, 2016 at 12:17 UTC | |
by haukex (Archbishop) on Jun 29, 2016 at 12:26 UTC | |
by RenMcCourtey (Acolyte) on Jun 29, 2016 at 12:32 UTC |