I have a file which contains a date at column 7, my requirement is to compare it with today's date and if it is less then it, than remove that complete line. Also if any date mentioned at column 7 is more then 15 days then modify it to maximum 15 days
example below-
now="$(date +'%d-%m-%Y')"
now=24-02-2021
file.txt
abc xyz pqr NFS 5 abc.vol
abc xyz pqr NFS 50 xyz.bal 23-02-2021
abc xyz pqr NFS 5 abcd.xyz
abc xyz pqr NFS 15 pqr.vol 25-02-2023
abc xyz pqr NFS 5 xyz.bal 24-03-2021
abc xyz pqr NFS 3 pqrst.vol 19-01-2019
output should be-
abc xyz pqr NFS 5 abc.vol
abc xyz pqr NFS 5 abcd.xyz
abc xyz pqr NFS 15 pqr.vol 11-03-2021
abc xyz pqr NFS 5 xyz.bal 24-03-2021
I tried through awk but it's fully not working
awk -v d=$now '$7 == "" && $7 < d' file.txt