I am a little versed in the differences between GNU sed and BSD sed. Unfortunately, I do not have a Linux machine, only a Mac is available.
I have a large data file in csv format, separated by a comma. Even the first two lines of the file are too large to publish here, you can find the first two lines here .
I need to replace the values ββ"0.8.9", -999, -999.0 with "NA", because these values ββare codes for missing values.
I used the following sed command in a bash prompt
sed -e 's/\-999\.?\0?/NA/g' \ -e 's/\-999/NA/g' \ -e 's/,9,/,NA,/g' \ -e 's/,8,/,NA,/g' \ -e 's/,0,/,NA,/g' \ firsttwolines.csv
The result looks great, but there is another 0 . How to fix it? And how to put it in a bash script? Is there a better way to accomplish this task?
source share