[BASH] Search for 5-digit numbers in document
How can I extract all sets of 5-digit numbers from a file. So anytime the script finds five digits in a group, it adds that number to the list, regardless of what letters are around it. For instance, if it encounters "a15520zuu19991 89123 13a24155" it will list 15520, 89123, and 24155 as 5-digit numbers it found. I am not worried about 6 digit pairs, as running into one is unlikely.
|
Maybe using grep
Code:
grep -o '[0-9]\{5\}' file.txt |
..and a "for" loop for feeding grep the chunks.
|
All times are GMT -5. The time now is 11:43 AM. |