1

i can handle the following case using notepad++ but i need to know how to do it through Linux.

Input

football},{swim

through notepad++ i can replace },{ with },\n{

Output

football}, {swim

How can i handle that through Linux using sed or awk ?

1

Here is how you would replace every instance of the substring },{ with the string },\n{ (where \n denotes a newline character):

sed 's/},{/},\n{/g'

And here is what it looks like in action:

user@host:~$ echo 'football},{swim},{gold}' \
| sed 's/},{/},\n{/g'

football},
{swim

user@host:~$ echo 'football},{swim},{gold}' \
| sed 's/},{/},\n{/g'

football},
{swim},
{gold}
  • that's will not make sense with football},{swim},{gold} – αԋɱҽԃ αмєяιcαη Dec 8 '17 at 0:15
  • Sorry, that was unnecessarily complicated. I guess I must be tired. I updated the solution. Is that what you want? – igal Dec 8 '17 at 0:19
  • here we go :D yes that's works :D thanks a lot – αԋɱҽԃ αмєяιcαη Dec 8 '17 at 0:20

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.