fork download
  1. #!/bin/bash
  2. echo "[as1,as2,as3],[as4,as5]" | perl -lpe 's/(?:\[|\G(?!^))[^]]*?\K,/|/g'
  3. echo "[as1,as2,as3],[as4,as5]" | perl -lpe 's/(?:\[|\G(?!^))[^],]*\K,/|/g'
  4.  
Success #stdin #stdout 0s 19632KB
stdin
Standard input is empty
stdout
[as1|as2|as3],[as4|as5]
[as1|as2|as3],[as4|as5]