#!/bin/bashs='John, 1234567Bob, 2839211Alex, 2817821Mary, 9371281'sed 's/^\([^,]*\), *[0-9]*\([0-9]\{4\}\).*/\1, \2/' <<< "$s"
Standard input is empty
John, 4567 Bob, 9211 Alex, 7821 Mary, 1281
The brand new service which powers Ideone!
Widget for compiling and running the source code in a web browser!