We help IT Professionals succeed at work.

how to fetch records from a fixed length file based on a value in a particular position

Hema I
Hema I asked
on
121 Views
Last Modified: 2017-05-24
i have fixed length file 'input.txt' as below in a remote location
abcdefgh001lmnopqrs
abcdefgh002lmnopqrs
abcdefgk001lmnopqrs
abcdefgh001lmnopqrs
abcdefgh004lmnopqrs

my result should have the count of records that are having h001 in position 8-11
i tried some thing like below.. still not getting result when run through command prompt
awk 'substr($1,9,11) =="h001" {print}'  //path/input.txt
Comment
Watch Question

Application Development and Automation Management
CERTIFIED EXPERT
Commented:
Unlock this solution and get a sample of our free trial.
(No credit card required)
UNLOCK SOLUTION
MURUGESAN NApplication Development and Automation Management
CERTIFIED EXPERT

Commented:
1. Resolved and retested.
2. Question inactive for 14 days.
Unlock the solution to this question.
Thanks for using Experts Exchange.

Please provide your email to receive a sample view!

*This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

OR

Please enter a first name

Please enter a last name

8+ characters (letters, numbers, and a symbol)

By clicking, you agree to the Terms of Use and Privacy Policy.