fork download
  1. #!/bin/bash
  2. s='John, 1234567
  3. Bob, 2839211
  4. Alex, 2817821
  5. Mary, 9371281'
  6. sed 's/^\([^,]*\), *[0-9]*\([0-9]\{4\}\).*/\1, \2/' <<< "$s"
Success #stdin #stdout 0s 4900KB
stdin
Standard input is empty
stdout
John, 4567
Bob, 9211
Alex, 7821
Mary, 1281