- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- More Script Help
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
04-29-2002 07:39 AM
04-29-2002 07:39 AM
faxstats -OUTBOUND -admin -all |sed '/$UPTO/,\$d'
where $UPTO is a date variable, i.e. "Apr 15"
If I surround the command in echo "" it prints the correct command and information. But, when I run it from a script I get the following error:
sed: 0602-404 Function /$UPTO/,\$d cannot be parsed.
Any ideas?
Thanks again,
Greg
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-29-2002 07:49 AM
04-29-2002 07:49 AM
Re: More Script Help
I'm not sure that I quite understand what you want to do but if all you want to do is delete all lines that have 'Apr 15' in them then this should do it:
UPTO="Apr 15"
faxstats -OUTBOUND -admin -all |sed "/${UPTO}/d"
Note the use of the double quotes to allow the varuable to be evaluated.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-29-2002 08:07 AM
04-29-2002 08:07 AM
Re: More Script Help
I thing you are trying to replace $UPTO by ",$d"
example
# t="somethis apr 15"
# t1="apr 15"
replace apr 15 by ttt
# echo $t |sed "s/$t1/ttt/g"
Sachin
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-29-2002 08:07 AM
04-29-2002 08:07 AM
Re: More Script Help
Before actually deleting the fax entries, I want to log which entries will be deleted. To do this I am using the "faxstats -OUTBOUND -admin -all" command to do a listing of the current entries in the database and sed to parse out the entries that are before the given $UPTO date. The faxstats/sed command works from the command line. It also seems to be loading the correct date variable when I echo the command in the script.
I have attached the script so far as well as a portion of the output of faxstats -OUTBOUND -admin -all.
Thanks again,
Greg
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-29-2002 08:21 AM
04-29-2002 08:21 AM
Re: More Script Help
To print the lines to be deleted:
UPTO="Apr 15"
faxstats -OUTBOUND -admin -all |sed -n "/${UPTO}/p"
Note the use of the -n option to suppress the default output.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-29-2002 08:22 AM
04-29-2002 08:22 AM
Re: More Script Help
If I understand correctly then you want to delete fax data older then 14 days and before you delete you want to save that to log file.
faxstats -OUTBOUND -admin -all | grep ${UPTO} > fax.logfile
then
as Clay says delete it
faxstats -OUTBOUND -admin -all |sed "/${UPTO}/d"
Sachin
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-29-2002 09:51 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-29-2002 10:00 AM
04-29-2002 10:00 AM
Re: More Script Help
this is a quoting problem:
\ quotes one meta character, which follows directly
'quoted_string' quotes EVERY meta character inside, the only thing not quoted is " ' " itself! No variable subsittution or command substitution inside of quoting! ( This is your problem.... )
"quoted_string" -->>> some meta characters are quoted, but within quoting variable substitution and command substitution is done!
So this should do it for you! Simply use "" instead of '' for quoting.
Allways stay on the bright side of life!
Peter
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-29-2002 10:52 AM
04-29-2002 10:52 AM
Re: More Script Help
Thanks again,
Greg