Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

print out specific data plus name of file scanned 2

Status
Not open for further replies.

jdespres

MIS
Aug 4, 1999
230
US
I would like to print between the following:

"filename scanned"
#################
Media Log entries
#################

Print anything between these two........

##############
Tape Pool info
##############

And not print the top or bottom headers..

I have the following so far:

/Media Log entries/, /Tape Pool info/
!/Media Log entries/
!/Tape Pool info/

I just want to print the filename scanned and the data in between

Thanks....

Joe Despres
 
Code:
awk '/^#/{++h;next}!h||h==2' /path/to/input

Hope This Helps, PH.
FAQ219-2884
FAQ181-2886
 
hhhmmmmmm...

I have other sections of data in the same files...

This code prints out the data in the first 2 sets of area's...


Thanks

Joe Despres
 
The following does everything I need except for identifying the file name scanned...

nawk '/Media Log entries/, /Tape Pool info/' NBU_media_info.rpt.0[5][0123][0123456789]2010|egrep -v "Tape Pool info|Media Log entries|##"

Thanks....

Joe Despres
 
awk supplies a variable named FILENAME

see man page

HTH,

p5wizard
 
You wanted this ?
Code:
nawk 'FNR==1{print FILENAME;h=0}/^#/{++h;next}h==2' NBU_media_info.rpt.0[5][0123][0123456789]2010

Hope This Helps, PH.
FAQ219-2884
FAQ181-2886
 
Looks like this works...........

for i in `ls NBU_media_info.rpt.0[5][0123][0123456789]2010`
do
echo "**************** $i ****************"
nawk '/Media Log entries/, /Tape Pool info/' $i | egrep -v "Tape Pool info|Media Log entries|##"
done

Thanks!

Joe Despres
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top