fork download
  1. #!/bin/bash
  2. perl -pe 's/\d+M(*SKIP)(*F)|.//g' <<< "23S62M1I19M2D"
  3.  
  4. perl -lane 'BEGIN{$a="";} while (/\d+M/g) {$a .= $&} END{print $a;}' <<< "23S62M1I19M2D"
  5.  
Success #stdin #stdout 0.01s 5520KB
stdin
Standard input is empty
stdout
62M19M
62M19M