regex - split multiple samecharacters onto their own line -


i tried this

sed -r "s/]]/]\n]/g" testfile.txt 

but don't think worked.

what i'm trying do:

take

[[[sometext 

would be

[ [ [sometext 

or

[[[[[[[[sometext 

would be

[ [ [ [ [ [ [ [sometext 

using grep -o easier using sed:

s='[[[[[[[[sometext'  grep -o '\[[^[]*' <<< "$s" [ [ [ [ [ [ [ [sometext 

if have use sed use:

sed 's/\[[^[]*/&\n/g' <<< "$s" [ [ [ [ [ [ [ [sometext 

Comments

Popular posts from this blog

javascript - Jquery show_hide, what to add in order to make the page scroll to the bottom of the hidden field once button is clicked -

javascript - Highcharts multi-color line -

javascript - Enter key does not work in search box -