Awk: Need to evaluate a string and delete line where the string matches

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:

C90-00-00-1441-0000000000000000494102008/01/11UNBILLED RECEIPTS
C90-00-00-1441-0000000000000005504002008/01/11UNBILLED RECEIPTS
C90-00-00-5165-0000000000000000000002008/01/11UNBILLED RECEIPTS

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.
LVL 1
ptewAsked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

TintinCommented:
awk is fine, but sed is just as easy

sed "/0000000000000002[0-9][0-9][0-9]\//D" file

0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
ptewAuthor Commented:
Wow, thanks for the fast response.  It works!  

Now, would you explain it to me?
0
TintinCommented:
Without knowing what values columns 15-22 could contain, I assumed they may not necessarily be zeros, so I've specified sed to delete any line that matches 15 zeros followed by 4 digit date ending with a /.

Does that make sense?
0
ptewAuthor Commented:
It makes sense now.  The /0000000000000002[0-9][0-9][0-9]\/ is the search string where the [0-9] makes it match any year from 2000 to 2999 (hopefully we will have upgraded by then) and \/ is the slash after the year.  The /D tells it to delete the line when matching.  Thanks!
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Shell Scripting

From novice to tech pro — start learning today.