Reputation: 3
I have a text file that I'm trying to process. The data is in the form of:
1002001 1 1 1 1 1 + 1 1.0e-4 1.24012 1.0e-4 0.44 + 1.0e-4 0.44 1.0 0.0 1.0 + 0.0 1.0 0.0 0.0 0.0 + 0.0 0.0 0.0 0.0 0.0
I would like to take all the lines that start with +
and move them to the line that starts with '1002001', like this (kind of like sed -r ':a;N;s/\n^\+//g;ba
):
1002001 1 1 1 1 1 1 1.0e-4 1.24012 1.0e-4 0.44 1.0e-4 0.44 1.0 0.0 1.0 0.0 1.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0
Upvotes: 0
Views: 36
Reputation: 11188
How about something like this:
(Get-Content yourfile.txt -Raw) -replace '[\r\n]+\+', ''
Upvotes: 4