- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- Want to pull particular dated lines out of a file
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
тАО01-13-2005 09:02 AM
тАО01-13-2005 09:02 AM
DATE=`date "+%b %d"`
grep $DATE /var/adm/syslog/syslog.log
Please post back.
Thanks!
Angie
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО01-13-2005 09:08 AM
тАО01-13-2005 09:08 AM
Solutionthe date contains blanks so you have to use quotes:
grep "$DATE" /var/adm/syslog/syslog.log
It was grepping for "Jan" in files "13" & syslog.log, and gave an error it could not find file "13".
regards,
Thierry.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО01-13-2005 09:10 AM
тАО01-13-2005 09:10 AM
Re: Want to pull particular dated lines out of a file
like in the below:
OLDsyslog.log:Jan 11 16:00:35 snowwhite sshd[7831]: Accepted publickey for wwwsync from 62.138.60.51 port 65260 ssh2
OLDsyslog.log:Jan 13 16:00:41 snowwhite sshd[29392]: Accepted publickey for wwwsync from 62.138.60.51 port 64093 ssh2
This will -hopefully - change if You simply change it to:
snowwhite:/var/adm/syslog# grep "$DATE" OLDsyslog.log
The hiphens (I think that's what they're called ;) will tell ksh to pass $DATE to grep as a single string instead of two separate ones.
best wishes,
florian
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО01-13-2005 09:10 AM
тАО01-13-2005 09:10 AM
Re: Want to pull particular dated lines out of a file
DATE=$(date '+^%b %d') # note the anchor "^"
grep -E "${DATE}" /var/adm/syslog/syslog.log # note the quotes around ${DATE}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО01-13-2005 09:14 AM
тАО01-13-2005 09:14 AM
Re: Want to pull particular dated lines out of a file
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО01-13-2005 11:58 AM
тАО01-13-2005 11:58 AM
Re: Want to pull particular dated lines out of a file
Thank you so much! I will make the modification and test it out.
Angie