[Thread Prev][Thread Next][Index]

[ferret_users] Re: ferret -script and arguments



Hi Patrick,
If you're running from the command line, you can put the list of names in quotes, and the whole string is treated as a single argument.

yes? go myscript "file1.nc,file2.nc"

For the "ferret -script" mode, you're right, because the command parser looks for commas to separate the arguments that will be sent to the script, it sees only the first name as argument 1. I don't see a way around that right now, but here is a workaround which I hope will be just as convenient.

If you put the list of files to open in a file, on a single line separated by commas, you can pass the name of that file to your script and have the script read the file names as a single string and use that string to open the files.

> echo "file1.nc,file2.nc" > file_list.dat

Start the script myscript.jnl with the commands

SET DATA/FORM=delimited/VAR=all_files/TYPE=text/DELIM=" " ($01)
DEFINE SYMBOL file_names = `all_files`
CANCEL DATA ($01)

USE ($file_names)
SHOW DATA

Then you can run this with

> ferret -script myscript.jnl file_list.dat

and all the data files are opened.

Patrick Brockmann wrote:

Hi all,

You can open several files with one line with following syntax:
yes? use file1.nc,file2.nc

But it is not possible to use this syntax when you use argument

In the script myscript.jnl designed with one 1st argument to open file(s)
use "($01)"

yes? go myscript file1.nc,file2.nc
or
ferret -script myscript.jnl file1.nc,file2.nc

will open only the 1st file (due to the parsing method).

Is there a way to get this "several-openning-files-in-one-line" with the script option?

Thanks
Patrick



[Thread Prev][Thread Next][Index]

Dept of Commerce / NOAA / OAR / PMEL / TMAP

Contact Us | Privacy Policy | Disclaimer | Accessibility Statement