Advertisement
Guest User

Untitled

a guest
Apr 21st, 2014
122
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 0.37 KB | None | 0 0
  1. $ STRING="(test)(te st) tesst. test test test test [teest] [teseeet]"
  2. $ echo "$STRING" | perl -lne '    @out = ();
  3.    /\( (.+?) \(/                 and push @out, $1;
  4.    /.+\( \K(.+?) \. (.+?)(?= \[)/ and push @out, $1, $2;
  5.    /(\[.+?\[)/                   and push @out, $1;
  6.    /.+\[ (....)/                and push @out, $1;
  7.    print join " ", @out
  8. '
  9. [teest] [
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement