fork download
  1. #!/bin/bash
  2. s='353451word2423157
  3. anotherword
  4. 7412yetanother1
  5. 3262andherese123anotherline4359013
  6. 5342512354325324523andherese123anotherline45913
  7. 532453andherese123anotherline413'
  8. perl -pe 's/^\d+(?=\d{2})|(\d{2})\d+$/$1/' <<< "$s"
Success #stdin #stdout 0.01s 5512KB
stdin
Standard input is empty
stdout
51word2423157
anotherword
12yetanother1
62andherese123anotherline4359013
23andherese123anotherline45913
53andherese123anotherline413