I have a script that delete all lines in a given file that has two patterns present, nameX and surnameX for example. The problem is that sometime in other fields further in the line the nameX can appear and it deletes the line also
nameX surnameX sdkflfjffsl sdlfjsd flsdkjsdjf sdlfdf > ok to delete
nameY surnameY ddsfdsfsfsf sf sdfdfdfdsfdsf fdf fsdf > keep line
nameY surnameX dfdsfsffsfsdf fsfsdfsff nameX fdsfffs > deletes, but i dont wat it to. How to proceed ?
My code is below
awk '$0!~v1 || $0!~v2' v1="nameX" v2="surnameX" /home/oldfile > /home/newfile
Help would be appreciatted :)
Aucun commentaire:
Enregistrer un commentaire