I have a text file containing lines of space separated data.
B 345678 2005-12-21 4174 1 62 11111 16543 1911 786543,45
However the spaces are kind of inconsistant and sometimes I suspect there are some added tabs too. I need to find a was to cut the line exactly before "62" which is a number that always occur in every line and it is somtimes followed by a 5-digit number and then always followed by another 5-digit number. I also add space before 62 to minimixe risk for mismatches.
So far I came up with this:
grep " 62 [1-9][0-9][0-9][0-9][0-9] " file
This will only give the lines where sometimes a 5-digit number shows up. I need a way to grep for 62 followed by an optional 5-digit numbers and then followed by a compulsary 5-digit number.
Can this be done?