Let sed&awk rule the world :-)

On 7/16/08, 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
>>
>>
>> >>
>>
>
>
> --
>
> Khamis Siksek
> http://saksoook.blogspot.com
>



-- 

Khamis Siksek
http://saksoook.blogspot.com

--~--~---------~--~----~------------~-------~--~----~
### 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
-~----------~----~----~----~------~----~------~--~---

رد على