How can I search lines in a text file for a pattern between two positions and print the entire row where that pattern is found? I am working with fixed-width files. I understand how to supply a list of lengths for each field to
awk, but I am only interested in searching a single field for the pattern. Is there a simpler solution that does not involve specifying the length for each field?
Here is a single line of text from the file. How can I find all lines that have 'Cook Co. IL' between positions 18 and 57 and not elsewhere in the line?
17 031 1602 1600 Cook Co. IL 047 011 9999 9999 Bradley Co. TN 16