Batch-converting mod to nl files

588 views
Skip to first unread message

Luis de la Torre

unread,
Aug 19, 2014, 4:04:18 PM8/19/14
to am...@googlegroups.com
I want to write nl files from a large number of mod files. Can I do this for each file with a one-liner from a terminal (so I can loop through all mod files and write nl files in a shell script)?

Thanks,

Luis de la Torre

victor.z...@gmail.com

unread,
Aug 19, 2014, 7:43:25 PM8/19/14
to am...@googlegroups.com
Yes, you can generate an .nl file from ampl files with -o option:

   ampl test.mod -ogtest.nl

which can be used in a shell loop such as

  for f in *.mod; do ampl -og$f.nl $f; done

See also the output of "ampl -h" and "ampl -o?" for more details on ampl command line options in general and -o in particular.

HTH,
Victor



--
You received this message because you are subscribed to the Google Groups "AMPL Modeling Language" group.
To unsubscribe from this group and stop receiving emails from it, send an email to ampl+uns...@googlegroups.com.
To post to this group, send email to am...@googlegroups.com.
Visit this group at http://groups.google.com/group/ampl.
For more options, visit https://groups.google.com/d/optout.

Luis de la Torre

unread,
Aug 20, 2014, 1:09:16 AM8/20/14
to am...@googlegroups.com
When I try this, I get "can't open -ogtest.nl"

If I do
ampl -> model test.mod; -> write gtest;
using the same mod file, I do successfully create an .nl file.

victor.z...@gmail.com

unread,
Aug 20, 2014, 9:17:12 AM8/20/14
to am...@googlegroups.com
Sorry, the -o option should precede the file names in the first example:

  ampl -ogtest.nl test.mod

HTH,
Victor
Reply all
Reply to author
Forward
0 new messages