- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- script for the error logs from multiple directorie...
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
тАО04-09-2009 02:27 PM
тАО04-09-2009 02:27 PM
ROW21_M2_HP1_20080809.163321_FTS_101/
ROW23_M2_HP1_20080809.164402_FTS_101/
ROW24_M2_HP1_20080809.165257_FTS_101/
ROW28_NO_HP1_20080809.171014_FTS_101/
ROW02_NO_HP1_20080809.171249_FTS_101/
ROW03_NO_HP1_20080809.172207_FTS_101/
ROW05_NO_HP1_20080809.173117_FTS_101/
ROW06_NO_HP1_20080809.173942_FTS_101/
ROW09_NO_HP1_20080809.174756_FTS_101/
ROW12_NO_HP1_20080809.175616_FTS_101/
ROW15_NO_HP1_20080809.180438_FTS_101/
I have a .log file in each of the directories above..
Is there a way or script by which I can grep for the string "failed" & the no. of failures(count) from all of the logs in the directories.
plz help
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО04-09-2009 03:05 PM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО04-09-2009 04:18 PM
тАО04-09-2009 04:18 PM
Re: script for the error logs from multiple directories
If you want the actual matching lines along with a count of the lines matched at the end, you could use:
# cat ./filter
#!/usr/bin/sh
LOG=/tmp/$(basename $0).$$
trap 'rm ${LOG}' EXIT
grep failed /var/MS/YER/ROW*101/*.log > ${LOG}
cat ${LOG}
wc -l < ${LOG}
exit
...run as:
# ./filter
By the way, please evaulate the answers you received to your previous post, too :-)
http://forums.itrc.hp.com/service/forums/questionanswer.do?threadId=1324828
Regards!
...JRF...
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО04-13-2009 04:15 AM
тАО04-13-2009 04:15 AM
Re: script for the error logs from multiple directories
I am about to run this script now... I have a small doubt...
what does the following line do in the script
trap 'rm ${LOG}' EXIT
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО04-13-2009 04:20 AM
тАО04-13-2009 04:20 AM
Re: script for the error logs from multiple directories
> what does the following line do in the script
trap 'rm ${LOG}' EXIT
This simply removes the file named by ${LOG} when the script exits. It's a convenient way to perform simple cleanup code, automatically, without explicitly calling a function or in-lining code, from any point in your script, when it exits.
Regards!
...JRF...