2

I want to use ncks in a batch script to select a variable an append it to a file:

ncks  -v ${var} $infile $outfile

But interactively it asks me whether I want to exit, overwrite or append.

On the help page of the command there is this tip:

"Some users may wish to avoid interactive ncks queries about whether to overwrite existing data. For example, batch scripts will fail if ncks does not receive responses to its queries. Options -O and -A are available to force overwriting existing files and variables, respectively."

but I don't want to overwrite, I wish to append, is there any way to do this?

ClimateUnboxed
  • 7,106
  • 3
  • 41
  • 86

1 Answers1

3

Try:

ncks -A -v ${var} $infile $outfile

For me it appended selected variable $var to the $outfile without the prompt.

msi_gerva
  • 2,021
  • 3
  • 22
  • 28