The problem I am working through is that I have a file that will contain fields delimited by a "|" and the file is sorted based on one of those fields. What I have been trying to come up with is a way to grab lines based on a range of a certain field.
an example:
Sample input would be something like this where it is sorted based on the 2nd field. So they are listed in alphabetical order
1234|abcd|3fgbe32
1234|abce|5fasdf3
5678|abcf|t438fjd
9876|abcg|57fshde
The range I want to get would then be "we want all records that fall in the range of abcd - abcf to be recorded into a different file. And the records remaining would be:
1234|abcd|3fgbe32
1234|abce|5fasdf33
5678|abcf|t438fjd
When I started I think I approached this in the wrong way. I was looping through each line and then trying to check the line against a regular expression to see if I wanted the line or not. But would there be a better way of doing this using awk and grep?