Hello,
My goal is the make all x times repeated lines into a single line.
I need to attain the expected output with sed -i , I need to overwrite the MyFile
MyFile:
Hello World
Welcome
Hello World
Welcome Back
This is my test
Expected output:
Hello World
Welcome
Welcome Back
This is my test
I found below code in another forum while searching but it did not solve the issue, even with sed -n :
sed -n '
:start
/^\[/{
h
:loop
n
/^\[/b start
/^$/b loop
x;p;g
}
p' MyFile
It would be nice if you would help me out on getting rid of this issue.
Many thanks
Boris
Dear Rudic,
My main aim was to overwrite with sed -i , for that reason I kindly asked if that was possible to execute with sed command but Perl is also okay.
Regarding your sed command, seems like my file is not compatible with your scenario. The terminal is waiting for printing the output but no action.
Kind regards
Boris
------ Post updated at 02:47 PM ------
Dear Rudic,
Even though I said "sorted out" but I see that sometimes newly created files are not accepting sed or perl command for this issue and it asks me to convert newly created files to unix with dos2unix command. Pc is running under ubuntu 18.04 bionic
How may I get rid of this? Maybe this could be a new thread topic.