- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - Linux
- >
- Re: find files between a certain stanza
Categories
Company
Local Language
Forums
Discussions
Forums
- Data Protection and Retention
- Entry Storage Systems
- Legacy
- Midrange and Enterprise Storage
- Storage Networking
- HPE Nimble Storage
Discussions
Discussions
Discussions
Forums
Forums
Discussions
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
- BladeSystem Infrastructure and Application Solutions
- Appliance Servers
- Alpha Servers
- BackOffice Products
- Internet Products
- HPE 9000 and HPE e3000 Servers
- Networking
- Netservers
- Secure OS Software for Linux
- Server Management (Insight Manager 7)
- Windows Server 2003
- Operating System - Tru64 Unix
- ProLiant Deployment and Provisioning
- Linux-Based Community / Regional
- Microsoft System Center Integration
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Community
Resources
Forums
Blogs
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО02-01-2007 12:19 AM
тАО02-01-2007 12:19 AM
I need help getting information from a file which is between two strings. Basically I have run a ps -fu
here is the script:
#!/bin/ksh
# check for zombies running
DATE=`date`
COUNT=0
if [ -f /usr/dump/JDE/data/in/STU* ] ; then
while [ $COUNT -lt 30 ]
do
echo "\n ####### CHECK PROCS $DATE #########" >>/tmp/zombiecheck.out
ps -fucronlog >> /tmp/zombiecheck.out
sleep 10
COUNT=$(($COUNT+1))
echo "\n ###################################" >> /tmp/zombiecheck.out
done
else
echo "\n ################ NO STU FILES PROCESSED $DATE#####" > /tmp/zombiecheck.out
fi
so I want to display:
####### CHECK PROCS $DATE #########
defunct
defunct
defunct
etc
#####################
####### CHECK PROCS $DATE #########"
etc
etc.
any idea's how I can use awk to achieve this?
many Thanks again guys.
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО02-01-2007 12:32 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО02-01-2007 12:36 AM
тАО02-01-2007 12:36 AM
Re: find files between a certain stanza
Well, use Perl;
# perl -ne 'print if (/# CHECK/ ... /# CHECK/)' file
Regards!
...JRF...
- Tags:
- Perl
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО02-01-2007 12:37 AM
тАО02-01-2007 12:37 AM
Re: find files between a certain stanza
perhaps something like this:
$ awk '$8 ~ /defunct/ {print $5 }' /tmp/zombiecheck.out
regards,
John K.
- Tags:
- awk
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО02-01-2007 01:11 AM
тАО02-01-2007 01:11 AM
Re: find files between a certain stanza
# print section of file between two regular expressions (inclusive)
sed -n '/Iowa/,/Montana/p' # case sensitive
From "handy one-liners for sed" (attached).
Pete
Pete
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО02-02-2007 03:20 AM
тАО02-02-2007 03:20 AM
Re: find files between a certain stanza
one thing about all these one liners ...
The information between
####### CHECK PROCS 0102071600 #########
and
######################
####### CHECK PROCS 0102071615 #########
and
######################
etc etc
Thanks again
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО02-05-2007 02:08 AM
тАО02-05-2007 02:08 AM
Re: find files between a certain stanza
grep -iE "CHECK PROCS $DATE|defunct|#####################" /tmp/zombiecheck.out
####### CHECK PROCS Thu 1 Feb 12:14:00 2007 #########
cronlog 64230 1 3 0:00
cronlog 78622 1 3 0:00
cronlog 111088 1 4 0:00
cronlog 172654 1 4 0:00
cronlog 180328 1 4 0:00
cronlog 203590 1 4 0:00
cronlog 353808 1 4 0:00
cronlog 382260 1 4 0:00
cronlog 476092 1 4 0:00
cronlog 492992 1 4 0:00
cronlog 503154 1 4 0:00
cronlog 644776 1 4 0:00
cronlog 649456 1 4 0:00
cronlog 685918 1 3 0:00
cronlog 760000 1 4 0:00
cronlog 864828 1 2 0:00
cronlog 913080 1 4 0:00
cronlog 927952 1 3 0:00
cronlog 959492 1 4 0:00
cronlog 982760 1 4 0:00
cronlog 1049558 1 4 0:00
cronlog 1110456 1 3 0:00
cronlog 1118196 1 4 0:00
cronlog 1159696 1 3 0:00
cronlog 1250982 1 3 0:00
cronlog 1296102 1 4 0:00
cronlog 1296372 1 4 0:00
cronlog 1301488 1 4 0:00
cronlog 1359654 1 4 0:00
cronlog 1360516 1 4 0:00
cronlog 1379770 1 4 0:00
###################################
#
magic!
Thanks for all the repsonses
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО02-05-2007 02:09 AM
тАО02-05-2007 02:09 AM