The UNIX and Linux Forums  
Hello and Welcome from United States to the UNIX and Linux Forums! Thank You for Visiting and Joining Our Global Community.

Go Back   The UNIX and Linux Forums > Top Forums > Shell Programming and Scripting
.
google unix.com



Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts and shell scripting languages here.

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
Find user password expiry date oztoma UNIX for Dummies Questions & Answers 4 04-17-2009 11:07 AM
Digital Certificate Expiry Date RG18173 UNIX for Advanced & Expert Users 1 02-06-2009 03:00 AM
How to extract date with time from file prash_b Shell Programming and Scripting 5 06-18-2008 09:30 AM
domain expiry date learnbash Shell Programming and Scripting 6 05-22-2008 04:43 AM
Extract Date from file magi Shell Programming and Scripting 2 09-30-2007 01:07 AM

 
English Japanese Spanish French German Portuguese Italian Dutch Swedish Russian Norwegian Hungarian Hebrew Danish Bulgarian Greek Powered by Powered by Google
 
LinkBack Thread Tools Search this Thread Rate Thread Display Modes
Prev Previous Post   Next Post Next
  #1 (permalink)  
Old 03-16-2009
pareshan pareshan is offline
Registered User
  
 

Join Date: Dec 2008
Posts: 24
Extract Expiry date and server_name from the following file

Hi Guys,
I am trying to write one ksh script where I have to go to lots of unix boxes and read one text file which will have data like this though this is not complete data. And I just have to extract expire date ( which is 2nd date value 08/31/2009 in the first one ) and the server name ( astro in first one ) which can be blank sometimes like "" from the text file and put it into local server for record from the all boxes

THis is the data loosk like inside that text file

# The following line is REQUIRED and must be the first line in license key file.
"Yours Trusted"
#
# SyncSort UNIX 08/31/2004 08/31/2009 "astro" "9000/800" 64 * * * X280-D-1
m1zy x530 4e13 hiej 1mr4 v3kt u833 8282
#
# SyncSort UNIX 08/31/2004 08/31/2009 "dhpalh2" "9000/800" 16 * * * X280-A-3
sny5 599a fvvc 4zdc c51y u0s9 fh32 7581
#
# SyncSort UNIX 09/15/2003 09/15/2008 "dhpgpl2" "9000/800" 16 * * * V876-U-2
px81 ivvi w8k1 m8hr 92h6 ynt8 um35 4279
#
# SyncSort UNIX 08/31/2004 08/31/2009 "dhpmafg1" "9000/800" 64 * * * X280-A-1
b5v9 cswp 9kzk v70s fc8t 9jwi 2835 3730

Any Help plese how to do it
I will appreciate the help
thank you


I have done it and now came up with the following list

01/02/2007 "thfires"
01/02/2007 "thfires"
01/02/2007 "thfires"
01/02/2007 "thfires"
01/02/2007 "thfires"
01/02/2007 "thfires"
01/02/2007 "thfires"
01/02/2007 "thfires"
01/02/2007 "thfires"
01/02/2007 "thfires"
01/02/2007 "thfires"
01/02/2007 "thfires"
01/03/2011 "dhttrn2"
01/03/2011 "dhttrn2"
01/03/2011 "dhttrn2"
01/03/2011 "dhttrn2"
01/03/2011 "dhttrn2"
01/03/2011 "dhttrn2"
01/03/2011 "dhttrn2"
01/03/2011 "dhttrn2"
01/03/2011 "dhttrn2"
01/03/2011 "dhttrn2"
01/03/2011 "dhttrn2"
01/03/2011 "dhttrn2"
02/10/2011 "dhpcrpt"
02/10/2011 "dhpcrpt"
02/10/2011 "dhpcrpt"
02/10/2011 "dhpcrpt"
02/10/2011 "dhpcrpt"
02/10/2011 "dhpcrpt"
02/10/2011 "dhpcrpt"
02/10/2011 "dhpcrpt"
02/10/2011 "dhpcrpt"
02/10/2011 "dhpcrpt"
02/10/2011 "dhpcrpt"
02/10/2011 "dhpcrpt"
02/28/2007 "wally"
02/28/2007 "wally"
02/28/2007 "wally"
02/28/2007 "wally"
02/28/2007 "wally"
02/28/2007 "wally"
02/28/2007 "wally"
02/28/2007 "wally"
02/28/2007 "wally"
02/28/2007 "wally"
02/28/2007 "wally"
02/28/2007 "wally"
03/01/2010 "dhqglr1"
03/01/2010 "dhqglr1"
03/01/2010 "dhqglr1"
03/01/2010 "dhqglr1"
03/01/2010 "dhqglr1"
03/01/2010 "dhqglr1"
03/01/2010 "dhqglr1"
03/01/2010 "dhqglr1"
03/01/2010 "dhqglr1"
03/01/2010 "dhqglr1"
03/01/2010 "dhqglr1"
03/01/2010 "dhqglr1"
03/01/2010 "dhqglr2"
03/01/2010 "dhqglr2"
03/01/2010 "dhqglr2"
03/01/2010 "dhqglr2"
03/01/2010 "dhqglr2"
03/01/2010 "dhqglr2"
03/01/2010 "dhqglr2"
03/01/2010 "dhqglr2"
03/01/2010 "dhqglr2"
03/01/2010 "dhqglr2"
03/01/2010 "dhqglr2"
03/01/2010 "dhqglr2"
03/14/2011 "dhpbos1"
03/14/2011 "dhpbos1"
03/14/2011 "dhpbos1"
03/14/2011 "dhpbos1"
03/14/2011 "dhpbos1"
03/14/2011 "dhpbos1"
03/14/2011 "dhpbos1"
03/14/2011 "dhpbos1"
03/14/2011 "dhpbos1"
03/14/2011 "dhpbos1"
03/14/2011 "dhpbos1"
03/14/2011 "dhpbos1"
03/14/2011 "dhpdls2b"
03/14/2011 "dhpdls2b"
03/14/2011 "dhpdls2b"
03/14/2011 "dhpdls2b"
03/14/2011 "dhpdls2b"
03/14/2011 "dhpdls2b"
03/14/2011 "dhpdls2b"
03/14/2011 "dhpdls2b"
03/14/2011 "dhpdls2b"
03/14/2011 "dhpdls2b"
03/14/2011 "dhpdls2b"
03/14/2011 "dhpdls2b"
03/14/2011 "dhpglr2b"
03/14/2011 "dhpglr2b"


now I have to sort the list in such a way that if expiration date has passed or within seven days from the date runs the script they should come first in the list followed by those between 8th day to 30th and rest whatever will be left and at the last number the list

Thank you
any help on this I think it should be easier I am trying also lets see what I can do

I will appreciate help

Last edited by pareshan; 03-16-2009 at 05:51 PM..
 

Bookmarks

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On




All times are GMT -4. The time now is 01:39 PM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited. Language Translations Powered by .
vBCredits v1.4 Copyright ©2007 - 2008, PixelFX Studios
The UNIX and Linux Forums Content Copyright ©1993-2009. All Rights Reserved.Ad Management by RedTyger

Content Relevant URLs by vBSEO 3.2.0