- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- Re: ksh 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
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
тАО04-01-2005 12:27 AM
тАО04-01-2005 12:27 AM
Re: ksh script help
Change 7days_back to days_back or sevendays_back
Good luck
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО04-01-2005 02:22 AM
тАО04-01-2005 02:22 AM
Re: ksh script help
I am getting null string for $sevenday $2 and $3 these are also null. please help.
Thanks
brian
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО04-01-2005 02:50 AM
тАО04-01-2005 02:50 AM
Re: ksh script help
perl -e '$sevenday = localtime(time-(7*24*60*60));print "$sevenday\n"'|awk '{print $2, $3}'
or this:
perl -e '$sevenday = localtime(time-(7*24*60*60));print "$sevenday\n"'
live free or die
harry d brown jr
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО04-01-2005 03:17 AM
тАО04-01-2005 03:17 AM
Re: ksh script help
that $sevendays thing works fine for me:
> ksh
$ SevenDaysBack=`perl -e '$sevenday = localtime(time-(7*24*60*60));print "$seven
day\n"'|awk '{print $2, $3}'`
$ echo $SevenDaysBack
Mar 25
fwiw, Personally it rubs me the wrong way to follow perl with awk when a trivial perl solution is available. For example:
$ perl -e '$_ = localtime(time-(7*24*60*60)); @old=split; print "$old[1] $old[2]
\n"'
Mar 25
$
To carry that theme forward, why not compare the dates in perl? Now the 'Mar 31' style date is hard to compare. So first convert it to seconds. Then compare with current time in seconds minus cutoff time. I don't know how to have perl do month-string to month-number nicely (Language independend, so I cheated and hardcoded a month table:
Start of a solution:
---- find_old.p ----
use Time::Local;
$year = (localtime)[5];
while (<>){
if (/(\w+)\s+(\d+)\s+(\d+):(\d+)$/) {
$mon = index("JanFebMarAprMayJunJulAugSepOctNovDec",$1)/3;
$t = timelocal(0,$4,$3,$2,$mon,$year);
print if ($t < time - (7*24*60*60))
}
}
---- sample output for slightly editted input sample ---
perl find_old.p lpstat.txt
brflora-295 aflorad1@essdbdu31 4330 Mar 21 19:30
brflora-298 aflorad1@essdbdu31 5444 Feb 2 19:30
It should be straight forwards to just print names, numbers, or email from that perl script.
Good luck,
Hein.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО04-01-2005 05:09 AM
тАО04-01-2005 05:09 AM
Re: ksh script help
I know that you are focused on the lpstat command.
I approached the problem differently
cd /var/spool/lp/request
find . -type file -mtime -7 -print
and then process that list.
good luck
Rory
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО04-01-2005 05:29 AM
тАО04-01-2005 05:29 AM
Re: ksh script help
Thanks a ton
Brian
- « Previous
-
- 1
- 2
- Next »