1

sed command playing with me!

view story
linux-howto

http://www.unix.com – Hello guys, I was working with my data (a tab delimted text file) in Linux and wanted to replace all "NaN" values in my huge table with "NA", so i used the following sed command: Code: sed 's/NaN/NA/g' /filepath -> outputfile.txt The results were good, all "NaN" were replaced with "NA", but the new output file had no headers no column names anymore! Example: Before: Code: V12 V13 V14 V15 V16 100 200 300 NaN 500 220 NaN 100 500 600 700 NaN 900 100 200 After: Code: 100 200 300 NA 500 220 NA 100 500 600 700 NA 900 100 200 Any idea wh (HowTos)