Project

General

Profile

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


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

    (1-2/2)