- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- Re: script wanted
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
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
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
07-21-2011 08:26 PM
07-21-2011 08:26 PM
script wanted
I have a database log ( db.log ) which the messages will be appended to it , some of the messages is non-useful , so I want to write a script to write all the lines that have the message "warning" to another log ( eg. db.log2 ), and then remove this line in db.log , as below example , can advise what can i do ? Thanks.
The log is as below
===================
#vi db.log
"
aaa
bbb
ccc
warning 111
ddd
eee
warning 222
fff
"
run the script , the desired output is as below
===============================================
#vi db.log
aaa
bbb
ccc
ddd
eee
fff
#vi db.log2
warning 111
warning 222
- Tags:
- grep
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-22-2011 04:05 AM
07-22-2011 04:05 AM
Re: script wanted
Would it be OK to get 'more' log files?
cp db.log db2.log
grep 'warning' db2.log > db.error.log
grep -v 'warning' db2.log > db.info.log
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-22-2011 06:15 PM
07-22-2011 06:15 PM
Re: script wanted
This is the wrong category for scripting.
What OS are you running? What command/shells are available?