I have data in a file where one column is a date column which has date in the following format:
2021-05-10T18:25:00.000+0100
2021-05-14T18:25:00.000+0100
2021-05-19T18:25:00.000+0100
Expected output is:
10 MAY 2021
14 MAY 2021
19 MAY 2021
My approach which I've tried:
while -r read line
do
year=`echo $line | awk '{ print $1 }' `
month=`echo $line | awk '{ print $2 }' `
dt=`echo $line | awk '{ print $3 }' `
v=$dt"-"$month"-"$year
d=date '`$v' | dd-mm-yyyy
echo $d
done < /f/filename.txt
2021-05-11T01:00:00.000+0100
and2021-05-10T23:00:00.000-0100
are the same time. Which date do you want output?numbers-numbers-numbers
with a dash as a separator should be in the formatYYYY-MM-DD
because of ISO 8601. If you want another format, please use something else as a separator, such as a space or a slash.