GreenLake Administration
- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- Re: Script help
Operating System - HP-UX
1846626
Members
2020
Online
110256
Solutions
Forums
Categories
Company
Local Language
back
Forums
Discussions
Forums
- Data Protection and Retention
- Entry Storage Systems
- Legacy
- Midrange and Enterprise Storage
- Storage Networking
- HPE Nimble Storage
Discussions
Forums
Discussions
Discussions
Forums
Discussions
back
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
Blogs
Information
Community
Resources
Community Language
Language
Forums
Blogs
Topic Options
- 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
10-23-2006 02:50 PM
10-23-2006 02:50 PM
Script help
Hi,
I need to script this process and not sure how to do it. Currently, I use command line to do the things. If I can use “awk” or “sed” to filter the dates out from the “xyz.master” file and use a simple script to create the file that will be great.
cat xyz.master | grep -i "2006/10/07-" > xyz.list
cat xyz.master | grep -i "2006/10/08-" >> xyz.list
cat xyz.master | grep -i "2006/10/09-" >> xyz.list
then we take the final file and sort using the following command and fileter out the stuff we don't need.
sort -k 4,4 -k 5,5 -k 3,3 xyz.list > xyz.sorted.list
I have try using simple loop but that did not work
while true
do
Command to execute
done
exit
Thanks I appreciate your help.
Mike
I need to script this process and not sure how to do it. Currently, I use command line to do the things. If I can use “awk” or “sed” to filter the dates out from the “xyz.master” file and use a simple script to create the file that will be great.
cat xyz.master | grep -i "2006/10/07-" > xyz.list
cat xyz.master | grep -i "2006/10/08-" >> xyz.list
cat xyz.master | grep -i "2006/10/09-" >> xyz.list
then we take the final file and sort using the following command and fileter out the stuff we don't need.
sort -k 4,4 -k 5,5 -k 3,3 xyz.list > xyz.sorted.list
I have try using simple loop but that did not work
while true
do
Command to execute
done
exit
Thanks I appreciate your help.
Mike
If there is problem then don't think as problem, think as opportunity.
3 REPLIES 3
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-23-2006 02:59 PM
10-23-2006 02:59 PM
Re: Script help
Well, I think you've left out some important details, but to accomplish exactly what have described, it takes just one line:
grep -e "2006/10/07-" -e "2006/10/08-" -e "2006/10/09-" xyz.master | sort -k 4,4 -k 5,5 -k 3,3 > xyz.sorted.list
I'm not sure why you are looking at a loop.
Bill Hassell, sysadmin
grep -e "2006/10/07-" -e "2006/10/08-" -e "2006/10/09-" xyz.master | sort -k 4,4 -k 5,5 -k 3,3 > xyz.sorted.list
I'm not sure why you are looking at a loop.
Bill Hassell, sysadmin
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-23-2006 07:07 PM
10-23-2006 07:07 PM
Re: Script help
Mike,
you can make your search more flexible, by using the -f option of grep.
Create a file "sdates" with your search dates:
2006/10/07-
2006/10/08-
2006/10/09-
Then use Bills solution:
grep -f sdates xyz.master | sort -k 4,4 -k 5,5 -k 3,3 > xyz.sorted.list
To add todays date to sdates:
date -u "+%Y/%m/%d-" >> sdates
In your original grep you also did not need the -i as you were searching for non-alphabetics.
you can make your search more flexible, by using the -f option of grep.
Create a file "sdates" with your search dates:
2006/10/07-
2006/10/08-
2006/10/09-
Then use Bills solution:
grep -f sdates xyz.master | sort -k 4,4 -k 5,5 -k 3,3 > xyz.sorted.list
To add todays date to sdates:
date -u "+%Y/%m/%d-" >> sdates
In your original grep you also did not need the -i as you were searching for non-alphabetics.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-30-2006 04:07 AM
10-30-2006 04:07 AM
Re: Script help
Thanks guys, appreciate your help.
Mike
Mike
If there is problem then don't think as problem, think as opportunity.
The opinions expressed above are the personal opinions of the authors, not of Hewlett Packard Enterprise. By using this site, you accept the Terms of Use and Rules of Participation.
Company
Events and news
Customer resources
© Copyright 2026 Hewlett Packard Enterprise Development LP