Skip to main content
edited tags
Link
Wiktor Stribiżew
  • 621.4k
  • 39
  • 480
  • 596
Source Link
arnpry
  • 1.1k
  • 2
  • 10
  • 26

Parse Groups Meeting Certain Conditions from String

I am trying to parse out to groups of numerics that match a certain criteria.

Text Sample

KBOS 052354Z 19012KT 10SM FEW075 BKN110 OVC200 24/14 A2975 RMK AO2 SLP074 T02390144 10289 20239 55002

Needed groups to be parsed

10289 20239

Attempted Code

echo "KBOS 052354Z 19012KT 10SM FEW075 BKN110 OVC200 24/14 A2975 RMK AO2 SLP074 T02390144 10289 20239 55002" | grep -E '^1[0-9][0-9][0-9][0-9]'
echo "KBOS 052354Z 19012KT 10SM FEW075 BKN110 OVC200 24/14 A2975 RMK AO2 SLP074 T02390144 10289 20239 55002" | grep -E '^2[0-9][0-9][0-9][0-9]'

What am I doing wrong?