Hi,
Script below is working. But I want to put a "=" after the new date format BUT excluding the extra space
$ cat x.bash
#!/bin/bash
#
cat x.txt
echo
awk '
BEGIN {
split("JAN FEB MAR APR MAY JUN JUL AUG SEP OCT NOV DEC", month, " ")
for (i=1; i<=12; i++) mdigit[month]=i
}
{ m=substr($1,4,3)
$1 = sprintf("%04d-%02d-%02d=",substr($1,8,4),mdigit[m],substr($1,1,2))
print
}' x.txt | sort | uniq > x.txt.00
cat x.txt.00
echo
Example run below:
$ ./x.bash
18-MAR-2020 04:28:13 * (CONNECT_DATA=(SERVER=DEDICATED)(SERVICE_NAME=
2020-03-18= 04:28:13 * (CONNECT_DATA=(SERVER=DEDICATED)(SERVICE_NAME=
Note the space after the day, trying to work out how to get rid of it The preferred output is
2020-03-18=04:28:13 * (CONNECT_DATA=(SERVER=DEDICATED)(SERVICE_NAME=
Tried this one below and still the same :(, still have the space
$1 = sprintf("%04d-%02d-%02d=",substr($1,8,4),mdigit[m],substr($1,1,2),substr($0,13))