Re: [exim] bash or perl question

Startseite
Nachricht löschen
Nachricht beantworten
Autor: Ian Eiloart
Datum:  
To: Chris Lightfoot, Nigel Metheringham
CC: exim-users
Betreff: Re: [exim] bash or perl question


--On 23 June 2006 15:19:58 +0100 Chris Lightfoot <chris@???>
wrote:

> On Fri, Jun 23, 2006 at 03:17:01PM +0100, Nigel Metheringham wrote:
>> On Fri, 2006-06-23 at 16:10 +0200, Daniel Tiefnig wrote:
>> > Gareth Hastings wrote:
>> > > cat file | awk -F. '{print $4"."$3"."$2"."$1}'
>> > >
>> > > (Less typing than above!!!!)
>> >
>> > UUOCAP (useless use of cat and pipe):
>> >
>> > awk -F. '{print $4"."$3"."$2"."$1}' file
>>
>> for perl aficionados...
>> perl -ne 'chomp;print join(".",reverse(split(/\./)),"\n"' file
>>
>> which is neither shorter, more comprehensible or more obvious than the
>> awk version... so I'm not sure why I posted it.
>
> surely you want?
>     cut -sd. -f1-4
> ?

>


No, it won't reverse the field order. Even "cut -sd. -f4,3,2,1" doesn't.
--
Ian Eiloart
IT Services, University of Sussex