|NARG (l)||NARG (l)|
Narg is a C-shell wrapper around the arg program to facilitate writing long scripts, where the same command or set of commands need to be repeated for a large number of input values (e.g., a list of file names, image names, numeric values, etc..). Using arg, one only needs to write a template for that script, in which the variable input is represented by a unique marker character (e.g., '&', '$', '%', '@') or character sequence (e.g., '$1', '$2', '%1', '%2', 'INFIL', 'OUFIL', 'X_IN', 'Y_IN') that is not used in the template script to denote anything other than such variable input.
Narg allows one to replace multiple marker strings with input from multiple files at once, for input lists that are matched in length (number of elements/lines).
Output is to the standard output (i.e., the screen) but may be redirected to any other device ( output ). If only one pair of inputs list and corresponding marker is provided, the result is identical to when running
$> arg -m0 <inputs> <template> <marker>
If narg is invoked with option -h , without any arguments, or with invalid arguments, a short version of this man-page is printed. For more information, see the man-page of arg .
1. Given a template script, build a large script (macro) for two types of data that required different global settings:
$> sed 's:$3:17:g' scripts/idlbatch.tem | sed 's:$4:4:g' > idlbatch.tem $> narg idlbatch.tem _broot.lis '$1' _bextn.lis '$2' > idlbatch $> sed 's:$3:15:g' scripts/idlbatch.tem | sed 's:$4:31:g' > idlbatch.tem $> narg idlbatch.tem _sroot.lis '$1' _sextn.lis '$2' >> idlbatch $> chmod 744 idlbatch ; ./idlbatch
cl> type scripts/domkpattmef.tem mkpattmef ("$1", psubpath="$2", origpath="$3", pattpath="$4", logfile="mkpattmef.log", verbose+) cl> !narg scripts/domkpattmef.tem _psubroot.lis '$1' _psubpath.lis '$2' _origpath.lis '$3' _pattpath.lis '$4' > domkpattmef.cl cl> cl < domkpattmef.cl
R.A. Jansen <Rolf.Jansen@asu.edu>
©1998–2013 R.A. Jansen/DinoSoft; The name 'arg' and one of the run-modes are based in part on earlier code by M. Franx.
|Rev. 2.3||23 May 2013||NARG (l)|