Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Excerpt
hiddentrue

Say you want to copy the first 3 messages. This can be done with:

% grib_copy -w count=1/2/3 in.grib out.grib

How do I copy a selected number of messages from a GRIB file?

Step-by-step guide

Say you want to copy the first 3 messages. This can be done with:

Code Block

...

$ grib_copy -w count=1/2/3 in.grib out.grib

But it is better to write a rules file and use grib_filter:

Code Block
languagebash
titlemy.filter
if (count < 4) {
  print "Copying message number [count]";
  write;
}

Then run this as follows:

Code Block

...

$ grib_filter -o out.grib my.filter in.grib

Of course you can make the IF condition more complicated e.g. select a range of messages to be copied:

Code Block
languagebash
if (count == 3 || count == 13) {
  write;  # Write out message 3 and 13 only
}



Content by Label
showLabelsfalse
max5
spaces~usa
showSpacefalse
sortmodified
reversetrue
typepage
cqllabel = "kb-how-to-article" and type = "page" and space = "UDOC"
labelskb-how-to-article

...