Awk: Need to evaluate a string and delete line where the string matches
Posted on 2008-11-06
We are running a legacy front-end system running in HP-UX 10.20. The system produces an ASCII interface file that is uploaded into our GL system. The interface file is positional with no delimiters as seen in this snippet:
I want to evaluate the transaction amount of each line with is the 15 characters in positions 22 through 37. If the string is 000000000000000, as in line three of my sample, I want to reject the line. The accountants seem to think It's important however that only the lines with zero-dollar amounts are rejected ;). I currently use AWK to substitute certain cost center portions. I know CUT -c15-37 would extract the range I am looking for.
How can this be accomplished using AWK or some other tool that one would find in an older UNIX environment?
Thanks for reviewing this question.