awk, swap elements A and B, pipe a command in place of an element
Karl Young
karly at kipshouse.org
Tue Apr 11 23:41:58 UTC 2017
Anton Yuzhaninov(citrin+bsd at 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
> _______________________________________________
> freebsd-questions at freebsd.org mailing list
> https://lists.freebsd.org/mailman/listinfo/freebsd-questions
> To unsubscribe, send any mail to "freebsd-questions-unsubscribe at freebsd.org"
More information about the freebsd-questions
mailing list