The title already states it:
I want to use some linux one liner (e.g. sed)
to transform
Anytext
{
into
Anytext{
Can this be done using sed or if not with sed then with an awk one liner ?
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
Sure,
Or a more thorough version:
Here,
:rsets a label that we can refer to in order to create a loop;$!{...}executes the given set of commands for every line except the last one;N;brare two commands the get executed in the loop:Nappends a new line to the pattern space, andbrbranches back to the labelr, completing the loop.Then you have all of your file in pattern space when you run the final command:
You can see the difference between the two approaches if you try it on something like