Handling Pipes and Redirection with VOV Wrappers
To use pipes or redirection on your command lines, apply these two methods:
- Use either the wrapper vov or vw2
- Hide the pipes and redirections in a script, instrument the script with VILtools, and then execute the script
For example, suppose that you need to execute the following command in your design
flow:
% sed 's/high/low/g' FILEIN | awk '{print "LINE", $0}' > OUT
which replaces all occurrences of "high" with "low", prints each line of the
resulting file with the prefix "LINE", and saves the result in the file OUT. This
command can be added to the graph with the following modification:
% vw2 sed 's/high/low/g' FILEIN \| awk '{print "LINE",$0}' \> OUT
Note the use of calling the program vw2 to run the shell command. The escaping of the symbols | and > is necessary so that the vw2 program can evaluate them and not the shell. Only stdout is piped and redirected in the present implementation. All tools in the pipeline must return 0 (zero) before the job can succeed. If any of the tools returns something else, vw2 reports the non-zero status it returns.
The second method listed above is based on a simple shell
script:
#!/bin/csh -f
# This is script highToLow.
VovInput $1 || exit 1
VovOutput $2 || exit 1
cat $1 | tr '[A-Z]' '[a-z]' > $2
exit $status
To execute the script without adding any nodes to the graph, use:
% highToLow fileA fileB
To have this activity create nodes in the graph, use:
% vov highToLow fileA fileB