Hi,
I am trying to understand a part of my existing code built by someone else and also try to bring in one more column in the output.
I have two files as below:
CSV file 1:
Scorecard_1,ZDTJ_PREV.EXT,12
Scorecard_2,ZACN_PREV.EXT,6
Scorecard_3,ABC.txt,8
Text file 2:
Acct_Bal_Non_Zero_Tgt.txt,7243
IDQ_HB1.txt,5380
IDQ_HB_LOGC.txt,5380
ZACN_PREV.EXT,4
ZDTJ_PREV.EXT,3
ABC.txt,10
Below is the piece of code:
awk '
BEGIN{
FS=OFS=","
}
FNR==NR{
arr[$2]=$NF
next
}
{
print $1,(($1 in arr)?($NF>arr[$1]?"Previous_Day_File":"Current_Day_File"):"No_Match")
}
' file1.csv file2.txt
I want to bring in col 1 from first file as well in my print output.
The script identifies the age of file and categorize as old or new file .
File 1 holds the filename and the interval (last column). File 2 holds the filename and the time difference ( last column which is calculated after current time-last modification time).
Now I just want to add col1 from first file as well in my output.