Skip to content
Advertisement

Tag: gsub

substitute consecutive tabs for “tNAt”

Have a badly formatted tsv file with empty fields all over the place. I wish to fill these empty spaces with “NA” on linux. I tried awk ‘{gsub(“tt”,”tNAt”); print$0)’ but that only substitutes one empty space to NA instance. Chaining the command awk ‘{gsub(“tt”,”tNAt”); print$0)|awk ‘{gsub(“tt”,”tNAt”); print$0) does two substitutions per line – but not particularly helpful if I have

Advertisement