mercredi 22 février 2017

Replace a word with awk using if else statement

I am trying to replace a word in awk using an if else statement.

Below is what I have already attempted. Basically if the thrid word is "Normal", change it to 0, else change it to 1.

awk -F "," '{(if $3=='Normal') {$3=0}; else {$3=1} }' filename

Aucun commentaire:

Enregistrer un commentaire