THIS IS EXACTLY WHAT I MEANT ABOUT KHAMIS AND REGULAR EXPRESSIONS!!!!!!
On Wed, Jul 16, 2008 at 11:36 AM, Khamis Siksek <[EMAIL PROTECTED]>
wrote:
> how about this one?
>
> more foo.txt | awk -F'/' '{OFS="/"; print $3,$1,$2}' | sed
> s'/\/\([[:digit:]]\)\//\/0\1\//g' | sed s'/\/\([[:digit:]]\)$/\/0\1/g'
>
> This shall work whether the system is 32-bit or 64-bit :-)
>
> explaination:
> 1- Awk will just arrange the numbers as required
> 2- First sed will replace the one digit between slashes (e.g. /3/) with
> same thing but adds a zero (e.g. /03/)
> 3- Second sed will replace the one digit at the end of the string (e.g.
> /5$) with same thing but adds a zero (e.g. /05$)
>
> Keep those coming Abdullah,
>
> Best regards,
>
>
> On 7/16/08, sci3ntist <[EMAIL PROTECTED]> wrote:
>>
>>
>> #!/bin/sh
>> IFS='-'
>> while read y m d; do
>> echo "$m-$d-$y" >> sumtxt.txt
>> done < datefile.txt
>>
>>
>>
>> >>
>>
--
Al-Faisal El-Dajani
Phone: +962-7-79737050
P.O Box: 140056
11814 Amman, Jordan
--~--~---------~--~----~------------~-------~--~----~
### Jordan Linux Users Group ###
http://Jolug.org/
http://groups.google.com/group/Jolug
### Ubuntu Jordan LoCo Team ###
https://wiki.ubuntu.com/JordanTeam
http://lists.ubuntu.com/ubuntu-jo
### Ojuba Linux ###
http://ojuba.org/
### Jordan PHP ###
http://groups.google.com/group/JoPHP
-~----------~----~----~----~------~----~------~--~---