- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- Re: Help needed to finish script
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
Forums
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
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
03-04-2004 08:48 PM
03-04-2004 08:48 PM
This command is part of a script I'm busy with -
cp /sdata/files/log/sabscan.l09 /sjtds/home/sabfiles/plp13.`date '+%d%m%y'`
Now , the sabscan.l09 file is an ever increasing , master file , but I need to add a command to my line that will only remove all the day's stuff and put it into the new plp12.(today's date) file. The command cannot use a specified date , as this is gonna run in a cron daily , so it's gonna update and create files daily.
Please help me URGENTLY !!!
Thank you
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-04-2004 09:04 PM
03-04-2004 09:04 PM
Re: Help needed to finish script
touch /sjtds/home/sabfiles/plp13.`date '+%d%m%y'` {create empty new daily file}
cat /sdata/files/log/sabscan.l09 >> /sjtds/home/sabfiles/plp13.`date '+%d%m%y'` {append data to new file}
cat /dev/null > /sdata/files/log/sabscan.l09 {empty master file}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-04-2004 09:04 PM
03-04-2004 09:04 PM
Re: Help needed to finish script
Is there a date entry is tyhe master file? if so you can do issue a date command that has the same output as in the file and do a awk script that prints all entrys after the date string and redirect it to todays file.
so:
VAR=$(date '+%d%m%y)
cat /sdata/files/log/sabscan.l09 | awk -v date=$VAR '/$VAR/ {start=1}
start=1 {print}'>>/sjtds/home/sabfiles/plp13.`date '+%d%m%y'`
HTH,
Gideon
PS. did not test this so may need to make adjustments to get it working.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-04-2004 09:05 PM
03-04-2004 09:05 PM
Solutiongrep `date +"%m %d"` /sdata/files/log/sabscan.l09 > /sjtds/home/sabfiles/plp13.`date '+%d%m%y'`
However, if there is no date in there at all then you are going to have to set up a cron job that moves sabscan.l09 to a backup file every day. Something like this
cat sabscan.l09 >> sabscan.l09.history && > sabscan.l09
Then you can use your normal script as sabscan.l09 will only ever contain todays data and sabscan.l09.history will contain all your previous days informatio
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-04-2004 09:31 PM
03-04-2004 09:31 PM
Re: Help needed to finish script
grep `date +"%d%m% y"` /sdata/files/log/sabscan.l09 > /sjtds/home/sabfiles/plp13.
`date '+%d%m%y'`
working like a bomb !
Cheers