Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

how to insert new line after a specific character in scripts

I have the following (example.txt) file:

blue(4) red(8) green(5) yellow(19) brown(60) black(5)

how can I achieve in unix the following result?

blue(4) 
red(8) 
green(5) 
yellow(19) 
brown(60) 
black(5)
like image 483
user601836 Avatar asked May 24 '12 14:05

user601836


1 Answers

If you need to insert newline after closing brackets, try

sed 's/) \?/)\n/g' example.txt
like image 62
Lev Levitsky Avatar answered Sep 30 '22 20:09

Lev Levitsky