1752793 Members
6247 Online
108789 Solutions
New Discussion юеВ

Re: grep the contents

 
syedar
Advisor

grep the contents

Hi all,

I have a file (T1.txt) which contains below information, i just need to get all "/a1" information and it's Number of records.
Please help me to get this output -Thanks.

OUTFILE 1: /a1
Number of records = 1319
OUTFILE 2: /a2
Number of records = 1319
OUTFILE 3: /a1
Number of records = 1561

5 REPLIES 5
N Ward
Regular Advisor

Re: grep the contents

If there is only 1 /a1 ref and its at the top in the file then a simple cat T1.txt | head -2 would work.
N Ward
Regular Advisor

Re: grep the contents

This may be more useful...

cat T1.txt | awk '/\/a1/, /Number/ {print $0}'
James R. Ferguson
Acclaimed Contributor

Re: grep the contents

Hi:

# perl -ne 'm{/a1}...{Number} and print' file

Regards!

...JRF...
syedar
Advisor

Re: grep the contents

Thanks for N Ward your solution is ok.
James R. Ferguson
Acclaimed Contributor

Re: grep the contents

Hi (again):

If you are satisfied with the answers you received, please assign points to say "thanks" and lead others to a solution for their problems:

http://forums11.itrc.hp.com/service/forums/helptips.do?#28

...JRF...