I have a file that contains the below records:
**cat Date.txt** SEPT,30-SEP-2017 MARCH,30-MAR-2018 JULY,30-JUL-2017 DECEM,30-DEC-2017 AUGS,30-AUG-2017 I want the output to be:
SEPT,20170930 MARCH,20180330 JULY,20170730 DECEM,20171230 AUGS,20170830 I have done a script with a while loop, as given below.
cat Date.txt > /tmp/exp.part while read line do Dat=$(echo $line | awk -F , '{print $1}') DatNew=$(date -d $Exp +%Y%m%d) echo $DatNew done < /tmp/exp.part I want to know if I can do it from the awk command, instead of writing a while loop.