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
Post a Comment