On 02-Feb-2003/00:51 +0000, RD Egeland <[EMAIL PROTECTED]> wrote:
>I'm just learning how to write shell scripts, and I'd like to find example 
>scripts to look at.  The BASH howto and Advanced BASH howto isn't too great 
>in this respect.
>
>The immediate task I'm trying to do is extract a date into a standardized 
>format which I can then somehow sort.  The text I need to extract the date 
>from looks like:
>
>Bid End time (eBay)       : Mon Feb  3 00:32:48 2003 (GMT)

Assuming the date string starts at the 22nd character and goes to the end
of the line, as in the line you provided:

enddate=`echo $line | cut -c 22- `
sortdate=`date -d "$enddate" +%Y%m%d%H%M%S`
echo $sortdate

Tony
-- 
Anthony E. Greene <mailto:[EMAIL PROTECTED]%3E>
OpenPGP Key: 0x6C94239D/7B3D BD7D 7D91 1B44 BA26  C484 A42A 60DD 6C94 239D
AOL/Yahoo Messenger: TonyG05    HomePage: <http://www.pobox.com/~agreene/>
Linux. The choice of a GNU generation <http://www.linux.org/>



-- 
redhat-list mailing list
unsubscribe mailto:[EMAIL PROTECTED]?subject=unsubscribe
https://listman.redhat.com/mailman/listinfo/redhat-list

Reply via email to