Removing a column in the output file
Added by ibomcha meitei about 4 years ago
Hi All,
I am extracting precipitation data for multiple locations.
When I used the followinf code
cdo -outputtab,name,date,time,value -remapnn,lon={}_lat={} -selyear,1970/2005 $f1.nc | awk 'FNR==1{ row=$2","$3$4","$5;print row } FNR!=1{ row=$1","$2$3","$4; print row}' > $f1.csv
My output looks good (Fig1).But, I wan to remove the column ="name" to reduce memory size.
If I removed name from the code, my Datetime column is distorted as in attached (Fig2).
I will be gratefull if anyone can suggest me.
Thanks
removed.png (9.01 KB) removed.png | Fig2 | ||
good.png (8.45 KB) good.png | Fig1 |
Replies (2)
RE: Removing a column in the output file - Added by Karin Meier-Fleischer about 4 years ago
Hi Bijoy,
this is an awk question but let me help you anyway. If you don't want the variable name you have to modify the awk command line, too.
Easy way ('datetime' output without blank as above)
cdo -outputtab,date,time,value -remapnn,lon={}_lat={} -selyear,1970/2005 $f1.nc | awk 'NR >= 2 {print $1$2","$3}' > $f1.csv
-Karin
RE: Removing a column in the output file - Added by ibomcha meitei about 4 years ago
Thanks a lot @Karin.