I have a Fixed Length text file as input where the character positions 4-5(two character positions starting from 4th position) indicates the LOB indicator. The file structure is something like below:
10126Apple DrinkOmaha
10231Milkshake New Jersey
103 Billabong Illinois
The requirement is to capture all the record(here the first and second) that contains strings like "26", "31", "24" and "78" as LOB Indicators in the 4th and 5th position(there can be more valid LOB indicator values coming up in the near future) of each record.
I know the process of awk, but want to know if this could be done using grep/sed.
they will serve as input to another downstream process.
In your solution, you've just checked the value of two consecutive column positions starting from position 4 against any numeric values between 0 and 9, but the requirement is completely different, as the data in these two positions will have discrete values like "26", "31", "24" or "78".
@Scrutinizer: What if the starting position of the LOB indicator field is 29th character position instead of 4th? Should I put 29 dots in my grep expression??