As part of the ‘scanvirus’, I need to search for lines with ‘scan interrupted’ but not ‘virus’.
11/17/2020 Scan interrupted: linux 18:13:36am 2020-11-10 {{bin;boot;home;lib;lib64;mnt;opt;root;run;sbin;selinux;usr;}
I know how to use if/then/else statements reading the file lines.
search ‘scan interrupted’ lines in file
skip that line if has search term ‘virus’
if found delete that line when copying to another file.
Can this format do the same without if/then/else statements?
printf "Cleaning Scanlogs
"
mv /var/log/VirusVault/VirusScanLog.txt /var/log/VirusVault/VirusScanLog_copy.txt
sed '/ Scan interrupted: /d' /var/log/VirusVault/VirusScanLog_copy.txt > /var/log/VirusVault/VirusScanLog.txt
rm /var/log/VirusVault/VirusScanLog_copy.txt
exit
Also:
If there any chance that a directory name could be skipped by having the same name as the search term.
input file format----{scanfolder;scanfolder;…}