Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 12 Apr 2017 07:32:37 -0500
From:      Antonio Olivares <olivares14031@gmail.com>
To:        Karl Young <karly@kipshouse.org>
Cc:        Anton Yuzhaninov <citrin+bsd@citrin.ru>, FreeBSD Questions <freebsd-questions@freebsd.org>
Subject:   Re: awk, swap elements A and B, pipe a command in place of an element
Message-ID:  <CAJ5UdcN=7jhdjEvd%2B6nXNQy=C%2BzLKPYhudMQOQnoxPtEXJMBxg@mail.gmail.com>
In-Reply-To: <20170411231407.GZ2787@mailboy.kipshouse.net>
References:  <CAJ5UdcNWej7jSjMTdZf6Rmf9-EiUBroU3HzN-1EiGZx=JSB2Vw@mail.gmail.com> <ed91685e-18ae-c69d-0b08-03107110a035@citrin.ru> <20170411231407.GZ2787@mailboy.kipshouse.net>

next in thread | previous in thread | raw e-mail | index | archive | help
On Tue, Apr 11, 2017 at 6:14 PM, Karl Young <karly@kipshouse.org> wrote:
> Anton Yuzhaninov(citrin+bsd@citrin.ru)@2017.04.11 17:18:47 -0400:
>> On 04/11/17 16:19, Antonio Olivares wrote:
>> > However if we have 3 elements, namely a
>> >
>> > TimeStamp  Home Away
>> > 1                  2       3
>> >
>> > We can swap 2 and 3 with above code.  However I want to format $1 with
>> > date -r "$i" "+%a %b %d %Y %I:%M %p" and then swap $2 and $3.  With
>> > regular BSD awk strftime command is not available.  We can use for
>> > command to format the timestamp
>>
>> echo "1491945088 x y" | awk '{ system("date -r "$1" \"+%a %b %d %Y %I:%M
>> %p\" | tr -d \"\n\""); print " "$3" "$2}'
>> Tue Apr 11 2017 05:11 PM y x
>>
>
> Heh heh.  Perl has no lock on TMTOWTDI
>

Thanks to both yourself and Anton for your suggestions.  This works
beautifully :)

Best Regards,


Antonio



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?CAJ5UdcN=7jhdjEvd%2B6nXNQy=C%2BzLKPYhudMQOQnoxPtEXJMBxg>