Issue
I have this text.
Code=200]:[ (381_3544|null|https_//cdn10.connected-stories.com)(
Penn State World Campus - San Deigo
|TV)]:677:01:SUCCESS
20220929010707:[url=https_//rtr.innovid.com/r1.62b49edb185030.50315160;cb=1372882909, breakId=1
I want to remove a new line \n end of "(" and "Deigo" Example:
Code=200]:[ (381_3544|null|https_//cdn10.connected-stories.com)(Penn State World Campus - San Deigo|TV)]:677:01:SUCCESS
20220929010707:[url=https_//rtr.innovid.com/r1.62b49edb185030.50315160;cb=1372882909, breakId=1
I tried using this command.
sed -ie "s/San Deigo\n/San Deigo/g"
It is not working. I also tried -z option but it deleted all the line and append to the first line.
Solution
With your shown samples please try following GNU awk
. Written and tested with shown samples only.
awk -v RS='\n[0-9]{14}:\\[url=https?_' '
FNR==1{
gsub(/\n/,"")
printf("%s%s",$0,RT)
}
END{
printf("%s",$0,"")
}
' Input_file
Answered By - RavinderSingh13 Answer Checked By - David Marino (WPSolving Volunteer)