Q:

variable assignment is not working in rhel6 linux

file1
ABY37499|ANK37528|DEL37508|SRILANKA|195203230000|445500759
ARJU7499|CHA38008|DEL37508|SRILANKA|195203230000|445500759
IB1704174|ANK37528|DEL37508|SRILANKA|195203230000|445500759
IB1704174|CHA38008|DEL37508|SRILANKA|195203230000|445500759
ABY37500|ANK37529|DEL37509|BRAZIL|195203240000|445500757
ARJU7500|CHA38009|DEL37509|BRAZIL|195203240000|445500757
IB1704175|ANK37529|DEL37509|BRAZIL|195203240000|445500757

i want to convert the fifth column date to another format script below
#!/bin/sh
dt="%Y-%m-%d %H:%M"
awk -F '|' '{print $5}' file1 | sed 's/.\{8\}/& /g'> f1.txt
aa=`(date -f f1.txt +"$dt")`
echo "$aa"
awk -F '|' '$5=$aa' file1

echo "$aa" got desired output but i cannot assign $aa to $5 please help me.
Thanks

A:

I corrected my answer after the commento of Etan Reisner

from AWK man:

The input is read in units called records, and processed by the rules
  of your program one record at a time. By default, each record is one
  line. Each record is automatically split into chunks called fields.
  This makes it more convenient for programs to work on the parts of a
  record.

Fields are stored in variables $1, $2, ...
And

The contents ofof the year as a number (001-366) | `%z` | Offset from UTC (-0500 is five hours behind UTC)

`%m` | Month as a number (01-12) | `%Z` | Time zone as a string (only available for converting time to a string)

`%M` | Minute as a number (00-59)

|  |

> Table 1 – characters used to define the formats of dates

More options are available and can be viewed using the `help(strftime)` command within the R environment.

## Converting time data types to strings

A date and time variable can be converted to a string using the `strftime` command. Its format is similar to the `strptime` command, except it has one additional option to determine whether or not to include time zone information in the resulting string. The command is a convenience