#!/bin/sh # ================================================================ set -e export MLR_CSV_DEFAULT_RS= # In case set in user's shell # For building with autoconf: # * in-directory build: # pwd is /path/to/the/tree/c/reg_test # path to mlr is /path/to/the/tree/c/mlr # path to reg_test/run is /path/to/the/tree/c/reg_test/run # # * out-of-directory ("VPATH") build: # pwd is /path/to/build/tree/c/reg_test # path to mlr is /path/to/build/tree/c/mlr # path to reg_test/run is /path/to/source/tree/c/reg_test/run # For building without autoconf: # pwd is /does/not/matter # path to mlr is /path/to/the/tree/c/mlr # path to reg_test/run is /path/to/the/tree/c/reg_test/run ourdir=`dirname $0` srcdir=$ourdir/../.. pwd=`pwd` try1=$pwd/../mlr # For autoconf builds, in-tree or out-of-tree try2=$srcdir/c/mlr # For non-autoconf builds if [ -x "$try1" ]; then path_to_mlr=$try1 elif [ -x "$try2" ]; then path_to_mlr=$try2 else echo "$0: Could not find path to mlr executable." 1>&2 echo "Try 1: $try1" 1>&2 echo "Try 2: $try2" 1>&2 exit 1 fi if [ "$1" = "--valgrind" ]; then # Leak-check the test suite. Needs 'make mlrg' first. # ../tools/clean-valg can be used to filter the output. path_to_mlr="valgrind --leak-check=full ${path_to_mlr}g" fi echo Using mlr executable $path_to_mlr indir=$ourdir/input expdir=$ourdir/expected outdir=$pwd/output-regtest reloutdir=./output-regtest outfile=$outdir/out expfile=$expdir/out mkdir -p $outdir rm -rvf $outdir mkdir -p $outdir touch $outfile echo num_passed=0 announce() { echo >> $outfile echo "================================================================" >> $outfile echo "$@" >> $outfile echo >> $outfile } mention() { echo >> $outfile echo ---------------------------------------------------------------- "$@" >> $outfile } # A key feature of this regression script is that it can be invoked from any # directory. Depending on the directory it's invoked from, the path to the mlr # executable may vary. Nonetheless for debugging it's crucial that we echo out # each command being executed. See also diff -I below. run_mlr() { # Use just "mlr" for info messages echo mlr "$@" echo mlr "$@" >> $outfile # Use path to mlr for invoking the command $path_to_mlr "$@" >> $outfile echo >> $outfile # since set -e num_passed=`expr $num_passed + 1` } # Just cats a file while also announcing that fact. run_cat() { echo cat "$@" echo cat "$@" >> $outfile # for diff at end cat "$@" >> $outfile # for diff at end echo >> $outfile } mlr_expect_fail() { # Use just "mlr" for info messages echo mlr "$@" echo mlr "$@" >> $outfile # Use path to mlr for invoking the command set +e $path_to_mlr "$@" >> $outfile 2>&1 status=$? if [ $status -ne 1 ]; then echo "Exit status was $status; expected 1." echo "Exit status was $status; expected 1." >> $outfile fi set -e echo >> $outfile test $status -eq 1 # since set -e num_passed=`expr $num_passed + 1` } # ================================================================ announce STATELESS MAPPERS run_mlr cat $indir/abixy run_mlr cat /dev/null run_mlr cat -n $indir/abixy run_mlr cat -N counter $indir/abixy run_mlr cut -f a,x $indir/abixy run_mlr cut --complement -f a,x $indir/abixy run_mlr cut -r -f c,e $indir/having-fields-regex.dkvp run_mlr cut -r -f '"C","E"' $indir/having-fields-regex.dkvp run_mlr cut -r -f '"c"i,"e"' $indir/having-fields-regex.dkvp run_mlr cut -r -f '"C"i,"E"' $indir/having-fields-regex.dkvp run_mlr cut -r -x -f c,e $indir/having-fields-regex.dkvp run_mlr cut -r -x -f '"C","E"' $indir/having-fields-regex.dkvp run_mlr cut -r -x -f '"C","E"i' $indir/having-fields-regex.dkvp run_mlr cut -r -x -f '"c","e"i' $indir/having-fields-regex.dkvp run_mlr --csvlite cut -r -f '^Name$,^Date_[0-9].*$' $indir/date1.csv $indir/date2.csv run_mlr having-fields --at-least a,b $indir/abixy run_mlr having-fields --at-least a,c $indir/abixy run_mlr having-fields --at-least a,b,i,x,y $indir/abixy run_mlr having-fields --which-are a,b,i,x $indir/abixy run_mlr having-fields --which-are a,b,i,x,y $indir/abixy run_mlr having-fields --which-are a,b,i,y,x $indir/abixy run_mlr having-fields --which-are a,b,i,x,w $indir/abixy run_mlr having-fields --which-are a,b,i,x,y,z $indir/abixy run_mlr having-fields --at-most a,c $indir/abixy run_mlr having-fields --at-most a,b,i,x,y $indir/abixy run_mlr having-fields --at-most a,b,i,x,y,z $indir/abixy run_mlr having-fields --all-matching '"^[a-z][a-z][a-z]$"' $indir/having-fields-regex.dkvp run_mlr having-fields --any-matching '"^[a-z][a-z][a-z]$"' $indir/having-fields-regex.dkvp run_mlr having-fields --none-matching '"^[a-z][a-z][a-z]$"' $indir/having-fields-regex.dkvp run_mlr having-fields --all-matching '"^[a-z][a-z][a-z]$"i' $indir/having-fields-regex.dkvp run_mlr having-fields --any-matching '"^[a-z][a-z][a-z]$"i' $indir/having-fields-regex.dkvp run_mlr having-fields --none-matching '"^[a-z][a-z][a-z]$"i' $indir/having-fields-regex.dkvp run_mlr rename b,BEE,x,EKS $indir/abixy run_mlr rename nonesuch,nonesuch,x,EKS $indir/abixy run_mlr --csvlite rename -r '^Date_[0-9].*$,Date' $indir/date1.csv $indir/date2.csv run_mlr --csvlite rename -r '(.*)e(.*),\1EEE\2' $indir/date1.csv $indir/date2.csv run_mlr --csvlite rename -r '"(.*)e(.*)"i,\1EEE\2' $indir/date1.csv $indir/date2.csv run_mlr --csvlite rename -r -g '"(.*)e(.*)"i,\1EEE\2' $indir/date1.csv $indir/date2.csv run_mlr --csvlite rename -r '"e",EEE' $indir/date1.csv $indir/date2.csv run_mlr --csvlite rename -r -g '"e",EEE' $indir/date1.csv $indir/date2.csv run_mlr --csvlite rename -r '"e"i,EEE' $indir/date1.csv $indir/date2.csv run_mlr --csvlite rename -r -g '"e"i,EEE' $indir/date1.csv $indir/date2.csv run_mlr regularize $indir/regularize.dkvp run_mlr --opprint bar -f x,y --lo 0 --hi 1 $indir/abixy run_mlr --opprint bar -f x,y -c c -x x -b b --lo 0.1 --hi 0.9 -w 20 $indir/abixy run_mlr --opprint bar --auto -f x,y -w 10 $indir/abixy # ---------------------------------------------------------------- announce TRIVIAL RETAINERS run_mlr group-by a $indir/abixy run_mlr group-by a,b $indir/abixy run_mlr group-like $indir/het.dkvp run_mlr tac $indir/abixy run_mlr tac /dev/null # ---------------------------------------------------------------- announce HEAD/TAIL/ETC. run_mlr head -n 2 $indir/abixy-het run_mlr head -n 2 -g a $indir/abixy-het run_mlr head -n 2 -g a,b $indir/abixy-het # Test early-out for unkeyed head run_mlr head -n 2 then put 'end{ print "Final NR is ".NR}' $indir/abixy-wide run_mlr head -n 2 -g a then put 'end{ print "Final NR is ".NR}' $indir/abixy-wide run_mlr cat then head -n 2 then put 'end{ print "Final NR is ".NR}' $indir/abixy-wide run_mlr tac then head -n 2 then put 'end{ print "Final NR is ".NR}' $indir/abixy-wide run_mlr head -n 2 then put 'end{ print "Final NR is ".NR}' $indir/abixy-wide $indir/abixy-wide $indir/abixy-wide run_mlr tail -n 2 $indir/abixy-het run_mlr tail -n 2 -g a $indir/abixy-het run_mlr tail -n 2 -g a,b $indir/abixy-het run_mlr top -f x,y -n 2 $indir/abixy-het run_mlr top -f x,y -n 2 -g a $indir/abixy-het run_mlr top -f x,y -n 2 -g a,b $indir/abixy-het run_mlr top -f x,y -n 2 $indir/ints.dkvp run_mlr top -f x,y -n 2 -F $indir/ints.dkvp run_mlr top -n 4 -f x $indir/abixy-wide run_mlr top -n 1 -f x,y $indir/abixy-wide run_mlr top -n 4 -f x -g a $indir/abixy-wide run_mlr top -n 1 -f x,y -g a $indir/abixy-wide run_mlr top -a -n 4 -f x $indir/abixy-wide run_mlr top -a -n 4 -f x -g a $indir/abixy-wide run_mlr top -n 3 -f x,y $indir/near-ovf.dkvp run_mlr top -n 3 -f x,y --min $indir/near-ovf.dkvp run_mlr top -F -n 3 -f x,y $indir/near-ovf.dkvp run_mlr top -F -n 3 -f x,y --min $indir/near-ovf.dkvp run_mlr --seed 12345 bootstrap $indir/abixy-het run_mlr --seed 12345 bootstrap -n 2 $indir/abixy-het run_mlr --seed 12345 bootstrap -n 20 $indir/abixy-het run_mlr --seed 12345 sample -k 2 $indir/abixy-het run_mlr --seed 12345 sample -k 2 -g a $indir/abixy-het run_mlr --seed 12345 sample -k 2 -g a,b $indir/abixy-het run_mlr --seed 12345 shuffle $indir/abixy-het run_mlr --seed 23456 shuffle $indir/abixy-het run_mlr --seed 34567 shuffle $indir/abixy-het run_mlr uniq -g a $indir/abixy-het run_mlr uniq -g a,b $indir/abixy-het run_mlr uniq -f a $indir/abixy-het run_mlr uniq -f a,b $indir/abixy-het run_mlr uniq -c -g a $indir/abixy-het run_mlr uniq -c -g a,b $indir/abixy-het run_mlr count-distinct -f a $indir/small $indir/abixy run_mlr count-distinct -f a,b $indir/small $indir/abixy run_mlr count-distinct -f a -n $indir/small $indir/abixy run_mlr count-distinct -f a,b -n $indir/small $indir/abixy run_mlr grep pan $indir/abixy-het run_mlr grep -v pan $indir/abixy-het run_mlr decimate -n 4 $indir/abixy run_mlr decimate -b -n 4 $indir/abixy run_mlr decimate -e -n 4 $indir/abixy run_mlr decimate -g a -n 2 $indir/abixy run_mlr decimate -g a -b -n 2 $indir/abixy run_mlr decimate -g a -e -n 2 $indir/abixy # ---------------------------------------------------------------- announce SORT run_mlr sort -f a $indir/abixy run_mlr sort -r a $indir/abixy run_mlr sort -f x $indir/abixy run_mlr sort -r x $indir/abixy run_mlr sort -nf x $indir/abixy run_mlr sort -nr x $indir/abixy run_mlr sort -f a,b $indir/abixy run_mlr sort -r a,b $indir/abixy run_mlr sort -f x,y $indir/abixy run_mlr sort -r x,y $indir/abixy run_mlr sort -nf x,y $indir/abixy run_mlr sort -nr x,y $indir/abixy run_mlr sort -f a -nr x $indir/abixy run_mlr sort -nr y -f a $indir/abixy run_mlr sort -f a -r b -nf x -nr y $indir/abixy run_mlr sort -f x $indir/sort-het.dkvp run_mlr sort -r x $indir/sort-het.dkvp # ---------------------------------------------------------------- announce JOIN run_mlr --opprint join -f $indir/joina.dkvp -l l -r r -j o $indir/joinb.dkvp run_mlr --opprint join -u -f $indir/joina.dkvp -l l -r r -j o $indir/joinb.dkvp run_mlr --opprint join --ul -f $indir/joina.dkvp -l l -r r -j o $indir/joinb.dkvp run_mlr --opprint join -u --ul -f $indir/joina.dkvp -l l -r r -j o $indir/joinb.dkvp run_mlr --opprint join --ur -f $indir/joina.dkvp -l l -r r -j o $indir/joinb.dkvp run_mlr --opprint join -u --ur -f $indir/joina.dkvp -l l -r r -j o $indir/joinb.dkvp run_mlr --opprint join --ul --ur -f $indir/joina.dkvp -l l -r r -j o $indir/joinb.dkvp run_mlr --opprint join -u --ul --ur -f $indir/joina.dkvp -l l -r r -j o $indir/joinb.dkvp run_mlr --opprint join --np --ul -f $indir/joina.dkvp -l l -r r -j o $indir/joinb.dkvp run_mlr --opprint join -u --np --ul -f $indir/joina.dkvp -l l -r r -j o $indir/joinb.dkvp run_mlr --opprint join --np --ur -f $indir/joina.dkvp -l l -r r -j o $indir/joinb.dkvp run_mlr --opprint join -u --np --ur -f $indir/joina.dkvp -l l -r r -j o $indir/joinb.dkvp run_mlr --opprint join --np --ul --ur -f $indir/joina.dkvp -l l -r r -j o $indir/joinb.dkvp run_mlr --opprint join -u --np --ul --ur -f $indir/joina.dkvp -l l -r r -j o $indir/joinb.dkvp run_mlr --opprint join -f /dev/null -l l -r r -j o $indir/joinb.dkvp run_mlr --opprint join -u -f /dev/null -l l -r r -j o $indir/joinb.dkvp run_mlr --opprint join --ul -f /dev/null -l l -r r -j o $indir/joinb.dkvp run_mlr --opprint join -u --ul -f /dev/null -l l -r r -j o $indir/joinb.dkvp run_mlr --opprint join --ur -f /dev/null -l l -r r -j o $indir/joinb.dkvp run_mlr --opprint join -u --ur -f /dev/null -l l -r r -j o $indir/joinb.dkvp run_mlr --opprint join --ul --ur -f /dev/null -l l -r r -j o $indir/joinb.dkvp run_mlr --opprint join -u --ul --ur -f /dev/null -l l -r r -j o $indir/joinb.dkvp run_mlr --opprint join --np --ul -f /dev/null -l l -r r -j o $indir/joinb.dkvp run_mlr --opprint join -u --np --ul -f /dev/null -l l -r r -j o $indir/joinb.dkvp run_mlr --opprint join --np --ur -f /dev/null -l l -r r -j o $indir/joinb.dkvp run_mlr --opprint join -u --np --ur -f /dev/null -l l -r r -j o $indir/joinb.dkvp run_mlr --opprint join --np --ul --ur -f /dev/null -l l -r r -j o $indir/joinb.dkvp run_mlr --opprint join -u --np --ul --ur -f /dev/null -l l -r r -j o $indir/joinb.dkvp run_mlr --opprint join -f $indir/joina.dkvp -l l -r r -j o /dev/null run_mlr --opprint join -u -f $indir/joina.dkvp -l l -r r -j o /dev/null run_mlr --opprint join --ul -f $indir/joina.dkvp -l l -r r -j o /dev/null run_mlr --opprint join -u --ul -f $indir/joina.dkvp -l l -r r -j o /dev/null run_mlr --opprint join --ur -f $indir/joina.dkvp -l l -r r -j o /dev/null run_mlr --opprint join -u --ur -f $indir/joina.dkvp -l l -r r -j o /dev/null run_mlr --opprint join --ul --ur -f $indir/joina.dkvp -l l -r r -j o /dev/null run_mlr --opprint join -u --ul --ur -f $indir/joina.dkvp -l l -r r -j o /dev/null run_mlr --opprint join --np --ul -f $indir/joina.dkvp -l l -r r -j o /dev/null run_mlr --opprint join -u --np --ul -f $indir/joina.dkvp -l l -r r -j o /dev/null run_mlr --opprint join --np --ur -f $indir/joina.dkvp -l l -r r -j o /dev/null run_mlr --opprint join -u --np --ur -f $indir/joina.dkvp -l l -r r -j o /dev/null run_mlr --opprint join --np --ul --ur -f $indir/joina.dkvp -l l -r r -j o /dev/null run_mlr --opprint join -u --np --ul --ur -f $indir/joina.dkvp -l l -r r -j o /dev/null run_mlr --odkvp join -u -j a -f $indir/join-het.dkvp $indir/abixy-het run_mlr --odkvp join -u -j a -f $indir/abixy-het $indir/join-het.dkvp run_mlr --odkvp join -u --np --ul --ur -j a -f $indir/join-het.dkvp $indir/abixy-het run_mlr --odkvp join -u --np --ul --ur -j a -f $indir/abixy-het $indir/join-het.dkvp for sorted_flag in "" "-u"; do for pairing_flags in "" "--np --ul" "--np --ur"; do for i in 1 2 3 4 5 6; do run_mlr join $sorted_flag $pairing_flags -l l -r r -j j -f $indir/het-join-left $indir/het-join-right-r$i for j in 1 2 3 4 5 6; do if [ "$i" -le "$j" ]; then run_mlr join $sorted_flag $pairing_flags -l l -r r -j j -f $indir/het-join-left $indir/het-join-right-r$i$j fi done done done done # ---------------------------------------------------------------- announce JOIN PREPIPE run_mlr --prepipe cat --odkvp join -u -j a -f $indir/join-het.dkvp $indir/abixy-het run_mlr --odkvp join --prepipe cat -u -j a -f $indir/join-het.dkvp $indir/abixy-het run_mlr --prepipe cat --odkvp join --prepipe cat -u -j a -f $indir/join-het.dkvp $indir/abixy-het # ---------------------------------------------------------------- announce JOIN MIXED-FORMAT # in1, in2, out all same formats run_mlr --json join -j x -f $indir/multi-format-join-a.json $indir/multi-format-join-b.json run_mlr --dkvp join -j x -f $indir/multi-format-join-a.dkvp $indir/multi-format-join-b.dkvp run_mlr --csvlite join -j x -f $indir/multi-format-join-a.csv $indir/multi-format-join-b.csv # in2 different format run_mlr --json join -i csvlite -j x -f $indir/multi-format-join-a.csv $indir/multi-format-join-b.json run_mlr --dkvp join -i csvlite -j x -f $indir/multi-format-join-a.csv $indir/multi-format-join-b.dkvp run_mlr --csvlite join -i csvlite -j x -f $indir/multi-format-join-a.csv $indir/multi-format-join-b.csv run_mlr --json join -i dkvp -j x -f $indir/multi-format-join-a.dkvp $indir/multi-format-join-b.json run_mlr --dkvp join -i dkvp -j x -f $indir/multi-format-join-a.dkvp $indir/multi-format-join-b.dkvp run_mlr --csvlite join -i dkvp -j x -f $indir/multi-format-join-a.dkvp $indir/multi-format-join-b.csv run_mlr --json join -i json -j x -f $indir/multi-format-join-a.json $indir/multi-format-join-b.json run_mlr --dkvp join -i json -j x -f $indir/multi-format-join-a.json $indir/multi-format-join-b.dkvp run_mlr --csvlite join -i json -j x -f $indir/multi-format-join-a.json $indir/multi-format-join-b.csv # vary all three run_mlr --ijson --ojson join -i csvlite -j x -f $indir/multi-format-join-a.csv $indir/multi-format-join-b.json run_mlr --idkvp --ojson join -i csvlite -j x -f $indir/multi-format-join-a.csv $indir/multi-format-join-b.dkvp run_mlr --icsvlite --ojson join -i csvlite -j x -f $indir/multi-format-join-a.csv $indir/multi-format-join-b.csv run_mlr --ijson --ojson join -i dkvp -j x -f $indir/multi-format-join-a.dkvp $indir/multi-format-join-b.json run_mlr --idkvp --ojson join -i dkvp -j x -f $indir/multi-format-join-a.dkvp $indir/multi-format-join-b.dkvp run_mlr --icsvlite --ojson join -i dkvp -j x -f $indir/multi-format-join-a.dkvp $indir/multi-format-join-b.csv run_mlr --ijson --ojson join -i json -j x -f $indir/multi-format-join-a.json $indir/multi-format-join-b.json run_mlr --idkvp --ojson join -i json -j x -f $indir/multi-format-join-a.json $indir/multi-format-join-b.dkvp run_mlr --icsvlite --ojson join -i json -j x -f $indir/multi-format-join-a.json $indir/multi-format-join-b.csv run_mlr --ijson --odkvp join -i csvlite -j x -f $indir/multi-format-join-a.csv $indir/multi-format-join-b.json run_mlr --idkvp --odkvp join -i csvlite -j x -f $indir/multi-format-join-a.csv $indir/multi-format-join-b.dkvp run_mlr --icsvlite --odkvp join -i csvlite -j x -f $indir/multi-format-join-a.csv $indir/multi-format-join-b.csv run_mlr --ijson --odkvp join -i dkvp -j x -f $indir/multi-format-join-a.dkvp $indir/multi-format-join-b.json run_mlr --idkvp --odkvp join -i dkvp -j x -f $indir/multi-format-join-a.dkvp $indir/multi-format-join-b.dkvp run_mlr --icsvlite --odkvp join -i dkvp -j x -f $indir/multi-format-join-a.dkvp $indir/multi-format-join-b.csv run_mlr --ijson --odkvp join -i json -j x -f $indir/multi-format-join-a.json $indir/multi-format-join-b.json run_mlr --idkvp --odkvp join -i json -j x -f $indir/multi-format-join-a.json $indir/multi-format-join-b.dkvp run_mlr --icsvlite --odkvp join -i json -j x -f $indir/multi-format-join-a.json $indir/multi-format-join-b.csv run_mlr --ijson --ocsvlite join -i csvlite -j x -f $indir/multi-format-join-a.csv $indir/multi-format-join-b.json run_mlr --idkvp --ocsvlite join -i csvlite -j x -f $indir/multi-format-join-a.csv $indir/multi-format-join-b.dkvp run_mlr --icsvlite --ocsvlite join -i csvlite -j x -f $indir/multi-format-join-a.csv $indir/multi-format-join-b.csv run_mlr --ijson --ocsvlite join -i dkvp -j x -f $indir/multi-format-join-a.dkvp $indir/multi-format-join-b.json run_mlr --idkvp --ocsvlite join -i dkvp -j x -f $indir/multi-format-join-a.dkvp $indir/multi-format-join-b.dkvp run_mlr --icsvlite --ocsvlite join -i dkvp -j x -f $indir/multi-format-join-a.dkvp $indir/multi-format-join-b.csv run_mlr --ijson --ocsvlite join -i json -j x -f $indir/multi-format-join-a.json $indir/multi-format-join-b.json run_mlr --idkvp --ocsvlite join -i json -j x -f $indir/multi-format-join-a.json $indir/multi-format-join-b.dkvp run_mlr --icsvlite --ocsvlite join -i json -j x -f $indir/multi-format-join-a.json $indir/multi-format-join-b.csv # ---------------------------------------------------------------- announce REPEAT run_mlr repeat -n 5 $indir/repeat-input.dat run_mlr repeat -f a $indir/repeat-input.dat run_mlr repeat -f b $indir/repeat-input.dat run_mlr repeat -f c $indir/repeat-input.dat # ---------------------------------------------------------------- announce RESHAPE run_mlr --pprint reshape -i X,Y,Z -o item,price $indir/reshape-wide.tbl run_mlr --pprint reshape -i X,Z -o item,price $indir/reshape-wide.tbl run_mlr --pprint reshape -r '[X-Z]' -o item,price $indir/reshape-wide.tbl run_mlr --pprint reshape -r '[XZ]' -o item,price $indir/reshape-wide.tbl run_mlr --pprint reshape -s item,price $indir/reshape-long.tbl run_mlr --pprint reshape -i X,Y,Z -o item,price then reshape -s item,price $indir/reshape-wide.tbl run_mlr --pprint reshape -s item,price then reshape -i X,Y,Z -o item,price $indir/reshape-long.tbl run_mlr reshape -i X,Y,Z -o item,price $indir/reshape-wide-ragged.dkvp run_mlr reshape -i X,Z -o item,price $indir/reshape-wide-ragged.dkvp run_mlr reshape -r '[X-Z]' -o item,price $indir/reshape-wide-ragged.dkvp run_mlr reshape -r '[XZ]' -o item,price $indir/reshape-wide-ragged.dkvp run_mlr reshape -s item,price $indir/reshape-long-ragged.dkvp run_mlr --json reshape -i x,y -o item,value $indir/small-non-nested.json # ---------------------------------------------------------------- announce NEST run_mlr cat $indir/nest-explode.dkvp run_mlr cat $indir/nest-explode-vary-fs-ps.dkvp run_mlr nest --explode --values --across-fields -f x $indir/nest-explode.dkvp run_mlr nest --explode --values --across-fields -f x --nested-fs pipe --nested-ps = $indir/nest-explode-vary-fs-ps.dkvp run_mlr nest --explode --values --across-fields -f x then nest --implode --values --across-fields -f x $indir/nest-explode.dkvp run_mlr nest --explode --values --across-fields -f x --nested-fs pipe --nested-ps = then nest --implode --values --across-fields -f x --nested-fs pipe --nested-ps = $indir/nest-explode-vary-fs-ps.dkvp run_mlr nest --explode --values --across-records -f x $indir/nest-explode.dkvp run_mlr nest --explode --values --across-records -f x --nested-fs pipe --nested-ps = $indir/nest-explode-vary-fs-ps.dkvp run_mlr nest --explode --values --across-records -f x then nest --implode --values --across-records -f x $indir/nest-explode.dkvp run_mlr nest --explode --values --across-records -f x --nested-fs pipe --nested-ps = then nest --implode --values --across-records -f x --nested-fs pipe --nested-ps = $indir/nest-explode-vary-fs-ps.dkvp run_mlr nest --explode --pairs --across-fields -f x $indir/nest-explode.dkvp run_mlr nest --explode --pairs --across-fields -f x --nested-fs pipe --nested-ps = $indir/nest-explode-vary-fs-ps.dkvp run_mlr nest --explode --pairs --across-records -f x $indir/nest-explode.dkvp run_mlr nest --explode --pairs --across-records -f x --nested-fs pipe --nested-ps = $indir/nest-explode-vary-fs-ps.dkvp # ---------------------------------------------------------------- announce SEQGEN run_mlr seqgen --start 1 --stop 5 --step 1 run_mlr seqgen --start 1 --stop 5 --step 2 run_mlr seqgen --start 1 --stop 1 --step 1 -f a run_mlr seqgen --start 5 --stop 1 --step 1 -f b run_mlr seqgen --start 5 --stop 1 --step -1 -f c run_mlr seqgen --start 5 --stop 5 --step -1 -f d run_mlr --from $indir/abixy cat then seqgen --start 1 --stop 5 # ---------------------------------------------------------------- announce STATS run_mlr --opprint stats1 -a mean,sum,count,min,max,mode -f i,x,y $indir/abixy run_mlr --opprint stats1 -a min,p10,p50,mode,p90,max -f i,x,y $indir/abixy run_mlr --opprint stats1 -a mean,meaneb,stddev -f i,x,y $indir/abixy run_mlr --oxtab stats1 -s -a mean,sum,count,min,max,mode -f i,x,y $indir/abixy run_mlr --opprint stats1 -a mean,sum,count,min,max,mode -f i,x,y -g a $indir/abixy run_mlr --opprint stats1 -a min,p10,p50,mode,p90,max -f i,x,y -g a $indir/abixy run_mlr --opprint stats1 -a mean,meaneb,stddev -f i,x,y -g a $indir/abixy run_mlr --oxtab stats1 -s -a mean,sum,count,min,max,mode -f i,x,y -g a $indir/abixy run_mlr --opprint stats1 -a mean,sum,count,min,max,mode -f i,x,y -g a,b $indir/abixy run_mlr --opprint stats1 -a min,p10,p50,mode,p90,max -f i,x,y -g a,b $indir/abixy run_mlr --opprint stats1 -a mean,meaneb,stddev -f i,x,y -g a,b $indir/abixy run_mlr --oxtab stats1 -s -a mean,sum,count,min,max,mode -f i,x,y -g a,b $indir/abixy run_mlr --oxtab stats1 -a mean -f x $indir/abixy-het run_mlr --oxtab stats1 -a mean -f x -g a $indir/abixy-het run_mlr --oxtab stats1 -a p0,p50,p100 -f x,y $indir/near-ovf.dkvp run_mlr --oxtab stats1 -a p0,p50,p100 -f x,y -F $indir/near-ovf.dkvp run_mlr --opprint stats2 -a linreg-ols,linreg-pca,r2,corr,cov -f x,y,xy,y2 $indir/abixy-wide run_mlr --opprint stats2 -a linreg-ols,linreg-pca,r2,corr,cov -f x,y,xy,y2 -g a,b $indir/abixy-wide run_mlr --oxtab stats2 -s -a linreg-ols,linreg-pca,r2,corr,cov -f x,y,xy,y2 $indir/abixy-wide-short run_mlr --oxtab stats2 -s -a linreg-ols,linreg-pca,r2,corr,cov -f x,y,xy,y2 -g a,b $indir/abixy-wide-short run_mlr --opprint stats2 --fit -a linreg-ols,linreg-pca -f x,y,xy,y2 $indir/abixy-wide-short run_mlr --opprint stats2 --fit -a linreg-ols,linreg-pca -f x,y,xy,y2 -g a $indir/abixy-wide-short run_mlr --opprint stats2 -a logireg -f x,y $indir/logi.dkvp run_mlr --opprint stats2 -a logireg -f x,y -g g $indir/logi.dkvp run_mlr --oxtab stats2 -a cov -f x,y $indir/abixy-het run_mlr --oxtab stats2 -a cov -f x,y -g a $indir/abixy-het run_mlr --opprint step -a rsum,shift,delta,counter -f x,y $indir/abixy run_mlr --opprint step -a rsum,shift,delta,counter -f x,y -g a $indir/abixy run_mlr --opprint step -a ewma -d 0.1,0.9 -f x,y -g a $indir/abixy run_mlr --opprint step -a ewma -d 0.1,0.9 -o smooth,rough -f x,y -g a $indir/abixy run_mlr --odkvp step -a rsum,shift,delta,counter -f x,y $indir/abixy-het run_mlr --odkvp step -a rsum,shift,delta,counter -f x,y -g a $indir/abixy-het run_mlr --opprint step -a ewma -d 0.1,0.9 -f x,y -g a $indir/abixy-het run_mlr --opprint step -a ewma -d 0.1,0.9 -o smooth,rough -f x,y -g a $indir/abixy-het run_mlr --icsvlite --opprint step -a from-first -f x $indir/from-first.csv run_mlr --icsvlite --opprint step -a from-first -f x -g g $indir/from-first.csv run_mlr --opprint histogram -f x,y --lo 0 --hi 1 --nbins 20 $indir/small run_mlr --opprint histogram --nbins 9 --auto -f x,y $indir/ints.dkvp run_mlr --csvlite --opprint merge-fields -a p0,min,p29,max,p100,sum -c _in,_out $indir/merge-fields-in-out.csv run_mlr --csvlite --opprint merge-fields -k -a p0,min,p29,max,p100,sum -c _in,_out $indir/merge-fields-in-out.csv run_mlr --csvlite --opprint merge-fields -i -a p0,min,p29,max,p100,sum -c _in,_out $indir/merge-fields-in-out.csv run_mlr --csvlite --opprint merge-fields -i -k -a p0,min,p29,max,p100,sum -c _in,_out $indir/merge-fields-in-out.csv run_mlr --oxtab merge-fields -k -a p0,min,p29,max,p100,sum,count -f a_in_x,a_out_x -o foo $indir/merge-fields-abxy.dkvp run_mlr --oxtab merge-fields -k -a p0,min,p29,max,p100,sum,count -r in_,out_ -o bar $indir/merge-fields-abxy.dkvp run_mlr --oxtab merge-fields -k -a p0,min,p29,max,p100,sum,count -c in_,out_ $indir/merge-fields-abxy.dkvp run_mlr --oxtab merge-fields -i -k -a p0,min,p29,max,p100,sum,count -f a_in_x,a_out_x -o foo $indir/merge-fields-abxy.dkvp run_mlr --oxtab merge-fields -i -k -a p0,min,p29,max,p100,sum,count -r in_,out_ -o bar $indir/merge-fields-abxy.dkvp run_mlr --oxtab merge-fields -i -k -a p0,min,p29,max,p100,sum,count -c in_,out_ $indir/merge-fields-abxy.dkvp # ---------------------------------------------------------------- announce MOST/LEAST FREQUENT run_mlr --opprint --from $indir/freq.dkvp most-frequent -f a -n 3 run_mlr --opprint --from $indir/freq.dkvp most-frequent -f a,b -n 3 run_mlr --opprint --from $indir/freq.dkvp most-frequent -f a,b -n 3 -b run_mlr --opprint --from $indir/freq.dkvp most-frequent -f nonesuch -n 3 run_mlr --opprint --from $indir/freq.dkvp least-frequent -f a -n 3 run_mlr --opprint --from $indir/freq.dkvp least-frequent -f a,b -n 3 run_mlr --opprint --from $indir/freq.dkvp least-frequent -f a,b -n 3 -b run_mlr --opprint --from $indir/freq.dkvp least-frequent -f nonesuch -n 3 # ---------------------------------------------------------------- announce NON-INTERPOLATED AND INTERPOLATED PERCENTILES for k in 1 2 3 4 5 6 7 8 9 10 11; do run_mlr --from $indir/x0to10.dat --oxtab head -n $k then stats1 -f x -a p00,p01,p02,p03,p04,p05,p06,p07,p08,p09,p10,p11,p12,p13,p14,p15,p16,p17,p18,p19,p20,p21,p22,p23,p24,p25,p26,p27,p28,p29,p30,p31,p32,p33,p34,p35,p36,p37,p38,p39,p40,p41,p42,p43,p44,p45,p46,p47,p48,p49,p50,p51,p52,p53,p54,p55,p56,p57,p58,p59,p60,p61,p62,p63,p64,p65,p66,p67,p68,p69,p70,p71,p72,p73,p74,p75,p76,p77,p78,p79,p80,p81,p82,p83,p84,p85,p86,p87,p88,p89,p90,p91,p92,p93,p94,p95,p96,p97,p98,p99,p100 done for k in 1 2 3 4 5 6 7 8 9 10 11; do run_mlr --from $indir/x0to10.dat --oxtab head -n $k then stats1 -i -f x -a p00,p01,p02,p03,p04,p05,p06,p07,p08,p09,p10,p11,p12,p13,p14,p15,p16,p17,p18,p19,p20,p21,p22,p23,p24,p25,p26,p27,p28,p29,p30,p31,p32,p33,p34,p35,p36,p37,p38,p39,p40,p41,p42,p43,p44,p45,p46,p47,p48,p49,p50,p51,p52,p53,p54,p55,p56,p57,p58,p59,p60,p61,p62,p63,p64,p65,p66,p67,p68,p69,p70,p71,p72,p73,p74,p75,p76,p77,p78,p79,p80,p81,p82,p83,p84,p85,p86,p87,p88,p89,p90,p91,p92,p93,p94,p95,p96,p97,p98,p99,p100 done # ---------------------------------------------------------------- announce DSL OPERATOR ASSOCIATIVITY # Note: filter -v and put -v print the AST. run_mlr put -v '$x = 1 || 2 || 3' /dev/null run_mlr filter -v ' 1 || 2 || 3' /dev/null run_mlr put -v '$x = 1 ^^ 2 ^^ 3' /dev/null run_mlr filter -v ' 1 ^^ 2 ^^ 3' /dev/null run_mlr put -v '$x = 1 && 2 && 3' /dev/null run_mlr filter -v ' 1 && 2 && 3' /dev/null run_mlr put -v '$x = 1 == 2 == 3' /dev/null run_mlr filter -v ' 1 == 2 == 3' /dev/null run_mlr put -v '$x = 1 != 2 != 3' /dev/null run_mlr filter -v ' 1 != 2 != 3' /dev/null run_mlr put -v '$x = 1 =~ 2 =~ 3' /dev/null run_mlr filter -v ' 1 =~ 2 =~ 3' /dev/null run_mlr put -v '$x = 1 !=~ 2 !=~ 3' /dev/null run_mlr filter -v ' 1 !=~ 2 !=~ 3' /dev/null run_mlr put -v '$x = 1 == 2 != 3' /dev/null run_mlr filter -v ' 1 == 2 != 3' /dev/null run_mlr put -v '$x = 1 != 2 == 3' /dev/null run_mlr filter -v ' 1 != 2 == 3' /dev/null run_mlr put -v '$x = 1 < 2 < 3' /dev/null run_mlr filter -v ' 1 < 2 < 3' /dev/null run_mlr put -v '$x = 1 <= 2 <= 3' /dev/null run_mlr filter -v ' 1 <= 2 <= 3' /dev/null run_mlr put -v '$x = 1 > 2 > 3' /dev/null run_mlr filter -v ' 1 > 2 > 3' /dev/null run_mlr put -v '$x = 1 >= 2 >= 3' /dev/null run_mlr filter -v ' 1 >= 2 >= 3' /dev/null run_mlr put -v '$x = 1 < 2 <= 3' /dev/null run_mlr filter -v ' 1 < 2 <= 3' /dev/null run_mlr put -v '$x = 1 <= 2 < 3' /dev/null run_mlr filter -v ' 1 <= 2 < 3' /dev/null run_mlr put -v '$x = 1 | 2 | 3' /dev/null run_mlr filter -v ' 1 | 2 | 3' /dev/null run_mlr put -v '$x = 1 ^ 2 ^ 3' /dev/null run_mlr filter -v ' 1 ^ 2 ^ 3' /dev/null run_mlr put -v '$x = 1 & 2 & 3' /dev/null run_mlr filter -v ' 1 & 2 & 3' /dev/null run_mlr put -v '$x = 1 | 2 & 3' /dev/null run_mlr filter -v ' 1 | 2 & 3' /dev/null run_mlr put -v '$x = 1 | 2 ^ 3' /dev/null run_mlr filter -v ' 1 | 2 ^ 3' /dev/null run_mlr put -v '$x = 1 ^ 2 | 3' /dev/null run_mlr filter -v ' 1 ^ 2 | 3' /dev/null run_mlr put -v '$x = 1 ^ 2 & 3' /dev/null run_mlr filter -v ' 1 ^ 2 & 3' /dev/null run_mlr put -v '$x = 1 & 2 | 3' /dev/null run_mlr filter -v ' 1 & 2 | 3' /dev/null run_mlr put -v '$x = 1 & 2 ^ 3' /dev/null run_mlr filter -v ' 1 & 2 ^ 3' /dev/null run_mlr put -v '$x = 1 << 2 << 3' /dev/null run_mlr filter -v ' 1 << 2 << 3' /dev/null run_mlr put -v '$x = 1 >> 2 >> 3' /dev/null run_mlr filter -v ' 1 >> 2 >> 3' /dev/null run_mlr put -v '$x = 1 << 2 >> 3' /dev/null run_mlr filter -v ' 1 << 2 >> 3' /dev/null run_mlr put -v '$x = 1 >> 2 << 3' /dev/null run_mlr filter -v ' 1 >> 2 << 3' /dev/null run_mlr put -v '$x = 1 + 2 + 3' /dev/null run_mlr filter -v ' 1 + 2 + 3' /dev/null run_mlr put -v '$x = 1 - 2 - 3' /dev/null run_mlr filter -v ' 1 - 2 - 3' /dev/null run_mlr put -v '$x = 1 + 2 - 3' /dev/null run_mlr filter -v ' 1 + 2 - 3' /dev/null run_mlr put -v '$x = 1 - 2 + 3' /dev/null run_mlr filter -v ' 1 - 2 + 3' /dev/null run_mlr put -v '$x = 1 . 2 . 3' /dev/null run_mlr filter -v ' 1 . 2 . 3' /dev/null run_mlr put -v '$x = 1 * 2 * 3' /dev/null run_mlr filter -v ' 1 * 2 * 3' /dev/null run_mlr put -v '$x = 1 / 2 / 3' /dev/null run_mlr filter -v ' 1 / 2 / 3' /dev/null run_mlr put -v '$x = 1 // 2 // 3' /dev/null run_mlr filter -v ' 1 // 2 // 3' /dev/null run_mlr put -v '$x = 1 % 2 % 3' /dev/null run_mlr filter -v ' 1 % 2 % 3' /dev/null run_mlr put -v '$x = 1 ** 2 ** 3' /dev/null run_mlr filter -v ' 1 ** 2 ** 3' /dev/null run_mlr put -v '$x = 1 * 2 / 3' /dev/null run_mlr filter -v ' 1 * 2 / 3' /dev/null run_mlr put -v '$x = 1 * 2 // 3' /dev/null run_mlr filter -v ' 1 * 2 // 3' /dev/null run_mlr put -v '$x = 1 * 2 % 3' /dev/null run_mlr filter -v ' 1 * 2 % 3' /dev/null run_mlr put -v '$x = 1 * 2 ** 3' /dev/null run_mlr filter -v ' 1 * 2 ** 3' /dev/null run_mlr put -v '$x = 1 / 2 * 3' /dev/null run_mlr filter -v ' 1 / 2 * 3' /dev/null run_mlr put -v '$x = 1 / 2 // 3' /dev/null run_mlr filter -v ' 1 / 2 // 3' /dev/null run_mlr put -v '$x = 1 / 2 % 3' /dev/null run_mlr filter -v ' 1 / 2 % 3' /dev/null run_mlr put -v '$x = 1 / 2 ** 3' /dev/null run_mlr filter -v ' 1 / 2 ** 3' /dev/null run_mlr put -v '$x = 1 // 2 * 3' /dev/null run_mlr filter -v ' 1 // 2 * 3' /dev/null run_mlr put -v '$x = 1 // 2 / 3' /dev/null run_mlr filter -v ' 1 // 2 / 3' /dev/null run_mlr put -v '$x = 1 // 2 % 3' /dev/null run_mlr filter -v ' 1 // 2 % 3' /dev/null run_mlr put -v '$x = 1 // 2 ** 3' /dev/null run_mlr filter -v ' 1 // 2 ** 3' /dev/null run_mlr put -v '$x = 1 % 2 * 3' /dev/null run_mlr filter -v ' 1 % 2 * 3' /dev/null run_mlr put -v '$x = 1 % 2 / 3' /dev/null run_mlr filter -v ' 1 % 2 / 3' /dev/null run_mlr put -v '$x = 1 % 2 // 3' /dev/null run_mlr filter -v ' 1 % 2 // 3' /dev/null run_mlr put -v '$x = 1 % 2 ** 3' /dev/null run_mlr filter -v ' 1 % 2 ** 3' /dev/null run_mlr put -v '$x = 1 ** 2 * 3' /dev/null run_mlr filter -v ' 1 ** 2 * 3' /dev/null run_mlr put -v '$x = 1 ** 2 / 3' /dev/null run_mlr filter -v ' 1 ** 2 / 3' /dev/null run_mlr put -v '$x = 1 ** 2 // 3' /dev/null run_mlr filter -v ' 1 ** 2 // 3' /dev/null run_mlr put -v '$x = 1 ** 2 % 3' /dev/null run_mlr filter -v ' 1 ** 2 % 3' /dev/null run_mlr put -v '$x = ++1' /dev/null run_mlr filter -v ' ++1' /dev/null run_mlr put -v '$x = --1' /dev/null run_mlr filter -v ' --1' /dev/null run_mlr put -v '$x = !!1' /dev/null run_mlr filter -v ' !!1' /dev/null run_mlr put -v '$x = ~~1' /dev/null run_mlr filter -v ' ~~1' /dev/null run_mlr put -v '$x = 1 ? 2 : 3' /dev/null run_mlr filter -v ' 1 ? 2 : 3' /dev/null run_mlr put -v '$x = 1 ? 2 ? 3 : 4 : 5' /dev/null run_mlr filter -v ' 1 ? 2 ? 3 : 4 : 5' /dev/null run_mlr put -v '$x = 1 ? 2 : 3 ? 4 : 5' /dev/null run_mlr filter -v ' 1 ? 2 : 3 ? 4 : 5' /dev/null # ---------------------------------------------------------------- announce DSL OPERATOR PRECEDENCE # Note: filter -v and put -v print the AST. run_mlr put -v '$x = 1 || 2 ^^ 3' /dev/null run_mlr filter -v ' 1 || 2 ^^ 3' /dev/null run_mlr put -v '$x = 1 || 2 && 3' /dev/null run_mlr filter -v ' 1 || 2 && 3' /dev/null run_mlr put -v '$x = 1 ^^ 2 || 3' /dev/null run_mlr filter -v ' 1 ^^ 2 || 3' /dev/null run_mlr put -v '$x = 1 ^^ 2 && 3' /dev/null run_mlr filter -v ' 1 ^^ 2 && 3' /dev/null run_mlr put -v '$x = 1 && 2 || 3' /dev/null run_mlr filter -v ' 1 && 2 || 3' /dev/null run_mlr put -v '$x = 1 && 2 ^^ 3' /dev/null run_mlr filter -v ' 1 && 2 ^^ 3' /dev/null run_mlr put -v '$x = 1 == 2 <= 3' /dev/null run_mlr filter -v ' 1 == 2 <= 3' /dev/null run_mlr put -v '$x = 1 <= 2 == 3' /dev/null run_mlr filter -v ' 1 <= 2 == 3' /dev/null run_mlr put -v '$x = 1 <= 2 | 3' /dev/null run_mlr filter -v ' 1 <= 2 | 3' /dev/null run_mlr put -v '$x = 1 | 2 <= 3' /dev/null run_mlr filter -v ' 1 | 2 <= 3' /dev/null run_mlr put -v '$x = 1 | 2 ^ 3' /dev/null run_mlr filter -v ' 1 | 2 ^ 3' /dev/null run_mlr put -v '$x = 1 ^ 2 | 3' /dev/null run_mlr filter -v ' 1 ^ 2 | 3' /dev/null run_mlr put -v '$x = 1 ^ 2 & 3' /dev/null run_mlr filter -v ' 1 ^ 2 & 3' /dev/null run_mlr put -v '$x = 1 & 2 ^ 3' /dev/null run_mlr filter -v ' 1 & 2 ^ 3' /dev/null run_mlr put -v '$x = 1 & 2 << 3' /dev/null run_mlr filter -v ' 1 & 2 << 3' /dev/null run_mlr put -v '$x = 1 << 2 & 3' /dev/null run_mlr filter -v ' 1 << 2 & 3' /dev/null run_mlr put -v '$x = 1 + 2 * 3' /dev/null run_mlr filter -v ' 1 + 2 * 3' /dev/null run_mlr put -v '$x = 1 * 2 + 3' /dev/null run_mlr filter -v ' 1 * 2 + 3' /dev/null run_mlr put -v '$x = 1 + (2 * 3)' /dev/null run_mlr filter -v ' 1 + (2 * 3)' /dev/null run_mlr put -v '$x = 1 * (2 + 3)' /dev/null run_mlr filter -v ' 1 * (2 + 3)' /dev/null run_mlr put -v '$x = (1 + 2) * 3' /dev/null run_mlr filter -v ' (1 + 2) * 3' /dev/null run_mlr put -v '$x = (1 * 2) + 3' /dev/null run_mlr filter -v ' (1 * 2) + 3' /dev/null run_mlr put -v '$x = 1 + 2 ** 3' /dev/null run_mlr filter -v ' 1 + 2 ** 3' /dev/null run_mlr put -v '$x = 1 ** 2 + 3' /dev/null run_mlr filter -v ' 1 ** 2 + 3' /dev/null run_mlr put -v '$x = 1 + (2 ** 3)' /dev/null run_mlr filter -v ' 1 + (2 ** 3)' /dev/null run_mlr put -v '$x = 1 ** (2 + 3)' /dev/null run_mlr filter -v ' 1 ** (2 + 3)' /dev/null run_mlr put -v '$x = (1 + 2) ** 3' /dev/null run_mlr filter -v ' (1 + 2) ** 3' /dev/null run_mlr put -v '$x = (1 ** 2) + 3' /dev/null run_mlr filter -v ' (1 ** 2) + 3' /dev/null run_mlr put -v '$x = 1 * 2 ** 3' /dev/null run_mlr filter -v ' 1 * 2 ** 3' /dev/null run_mlr put -v '$x = 1 ** 2 * 3' /dev/null run_mlr filter -v ' 1 ** 2 * 3' /dev/null run_mlr put -v '$x = 1 * (2 ** 3)' /dev/null run_mlr filter -v ' 1 * (2 ** 3)' /dev/null run_mlr put -v '$x = 1 ** (2 * 3)' /dev/null run_mlr filter -v ' 1 ** (2 * 3)' /dev/null run_mlr put -v '$x = (1 * 2) ** 3' /dev/null run_mlr filter -v ' (1 * 2) ** 3' /dev/null run_mlr put -v '$x = (1 ** 2) * 3' /dev/null run_mlr filter -v ' (1 ** 2) * 3' /dev/null run_mlr put -v '$x = -1 + 2 * 3' /dev/null run_mlr filter -v ' -1 + 2 * 3' /dev/null run_mlr put -v '$x = -1 * 2 + 3' /dev/null run_mlr filter -v ' -1 * 2 + 3' /dev/null run_mlr put -v '$x = 1 + -2 * 3' /dev/null run_mlr filter -v ' 1 + -2 * 3' /dev/null run_mlr put -v '$x = 1 * -2 + 3' /dev/null run_mlr filter -v ' 1 * -2 + 3' /dev/null run_mlr put -v '$x = 1 + 2 * -3' /dev/null run_mlr filter -v ' 1 + 2 * -3' /dev/null run_mlr put -v '$x = 1 * 2 + -3' /dev/null run_mlr filter -v ' 1 * 2 + -3' /dev/null run_mlr put -v '$x = ~1 | 2 & 3' /dev/null run_mlr filter -v ' ~1 | 2 & 3' /dev/null run_mlr put -v '$x = ~1 & 2 | 3' /dev/null run_mlr filter -v ' ~1 & 2 | 3' /dev/null run_mlr put -v '$x = 1 | ~2 & 3' /dev/null run_mlr filter -v ' 1 | ~2 & 3' /dev/null run_mlr put -v '$x = 1 & ~2 | 3' /dev/null run_mlr filter -v ' 1 & ~2 | 3' /dev/null run_mlr put -v '$x = 1 | 2 & ~3' /dev/null run_mlr filter -v ' 1 | 2 & ~3' /dev/null run_mlr put -v '$x = 1 & 2 | ~3' /dev/null run_mlr filter -v ' 1 & 2 | ~3' /dev/null run_mlr put -v '$x = $a==1 && $b == 1 && $c == 1' /dev/null run_mlr filter -v ' $a==1 && $b == 1 && $c == 1' /dev/null run_mlr put -v '$x = $a==1 || $b == 1 && $c == 1' /dev/null run_mlr filter -v ' $a==1 || $b == 1 && $c == 1' /dev/null run_mlr put -v '$x = $a==1 || $b == 1 || $c == 1' /dev/null run_mlr filter -v ' $a==1 || $b == 1 || $c == 1' /dev/null run_mlr put -v '$x = $a==1 && $b == 1 || $c == 1' /dev/null run_mlr filter -v ' $a==1 && $b == 1 || $c == 1' /dev/null run_mlr put -v '$x = $a==1 ? $b == 2 : $c == 3' /dev/null run_mlr filter -v ' $a==1 ? $b == 2 : $c == 3' /dev/null run_mlr put -v '$x = true' /dev/null run_mlr filter -v ' true' /dev/null run_mlr put -v 'true || 1==0; $x = 3' /dev/null run_mlr filter -v ' true || 1==0' /dev/null run_mlr put -v '1==0 || false; $x = 3' /dev/null run_mlr filter -v ' 1==0 || false' /dev/null run_mlr put -v 'true && false; $x = 3' /dev/null run_mlr filter -v ' true && false' /dev/null run_mlr put -v 'true && false && true; $x = 3' /dev/null run_mlr filter -v ' true && false && true' /dev/null run_mlr put -v '$y += $x + 3' /dev/null run_mlr put -v '$y += $x * 3' /dev/null run_mlr put -v '$y ||= $x' /dev/null run_mlr put -v '$y ^^= $x' /dev/null run_mlr put -v '$y &&= $x' /dev/null run_mlr put -v '$y |= $x' /dev/null run_mlr put -v '$y ^= $x' /dev/null run_mlr put -v '$y &= $x' /dev/null run_mlr put -v '$y <<= $x' /dev/null run_mlr put -v '$y >>= $x' /dev/null run_mlr put -v '$y += $x' /dev/null run_mlr put -v '$y -= $x' /dev/null run_mlr put -v '$y .= $x' /dev/null run_mlr put -v '$y *= $x' /dev/null run_mlr put -v '$y /= $x' /dev/null run_mlr put -v '$y //= $x' /dev/null run_mlr put -v '$y %= $x' /dev/null run_mlr put -v '$y **= $x' /dev/null # ---------------------------------------------------------------- announce DSL COMMENTS run_mlr --from $indir/abixy put ' $s = 1; #$t = 2; $u = 3; ' run_mlr --from $indir/abixy filter ' NR == 1 || #NR == 2 || NR == 3 ' run_mlr --from $indir/abixy put ' $s = "here is a pound#sign"; # but this is a comment #$t = 2; $u = 3; ' # ---------------------------------------------------------------- announce DSL EMPTY STATEMENTS run_mlr -n put -v '' mlr_expect_fail -n filter -v '' run_mlr -n put -v 'begin {}' run_mlr -n put -v 'begin {;}' run_mlr -n put -v 'begin {;;}' run_mlr -n put -v 'begin {;;;}' run_mlr -n put -v 'begin {@x=1}' run_mlr -n put -v 'begin {@x=1;}' run_mlr -n put -v 'begin {;@x=1}' run_mlr -n put -v 'begin {@x=1;@y=2}' run_mlr -n put -v 'begin {@x=1;;@y=2}' run_mlr -n put -v 'true {}' run_mlr -n put -v 'true {;}' run_mlr -n put -v 'true {;;}' run_mlr -n put -v 'true {;;;}' run_mlr -n put -v 'true {@x=1}' run_mlr -n put -v 'true {@x=1;}' run_mlr -n put -v 'true {;@x=1}' run_mlr -n put -v 'true {@x=1;@y=2}' run_mlr -n put -v 'true {@x=1;;@y=2}' run_mlr -n put -v 'end {}' run_mlr -n put -v 'end {;}' run_mlr -n put -v 'end {;;}' run_mlr -n put -v 'end {;;;}' run_mlr -n put -v 'end {@x=1}' run_mlr -n put -v 'end {@x=1;}' run_mlr -n put -v 'end {;@x=1}' run_mlr -n put -v 'end {@x=1;@y=2}' run_mlr -n put -v 'end {@x=1;;@y=2}' # ---------------------------------------------------------------- announce DSL CONTEXT-SPECIFIC VALIDATION mention non-top-level begin/end mlr_expect_fail put -v 'begin{begin{@x=1}}' mlr_expect_fail put -v 'true{begin{@x=1}}' mlr_expect_fail put -v 'end{end{@x=1}}' mlr_expect_fail put -v 'true{end{@x=1}}' mention srecs in begin/end mlr_expect_fail put -v 'begin{$x=1}' mlr_expect_fail put -v 'begin{@x=$y}' mlr_expect_fail put -v 'end{$x=1}' mlr_expect_fail put -v 'end{@x=$y}' mlr_expect_fail put -v 'begin{@v=$*}' mlr_expect_fail put -v 'end{$*=@v}' mlr_expect_fail put -v 'begin{unset $x}' mlr_expect_fail put -v 'end{unset $x}' mlr_expect_fail put -v 'begin{unset $*}' mlr_expect_fail put -v 'end{unset $*}' mention break/continue outside loop mlr_expect_fail put -v 'break' mlr_expect_fail put -v 'continue' mention oosvars etc. in mlr filter mlr_expect_fail filter -v 'break' mlr_expect_fail filter -v 'continue' mention expanded filter run_mlr --from $indir/abixy filter ' begin { @avoid = 3 } NR != @avoid ' run_mlr --from $indir/abixy filter -x ' begin { @avoid = 3 } NR != @avoid ' run_mlr --from $indir/abixy filter ' func f(n) { return n - 1 } f(NR) == 5 ' run_mlr --from $indir/abixy filter ' subr s(n) { print "NR is ".n } call s(NR); false ' run_mlr --from $indir/abixy filter ' int a = 5; int b = 7; a <= NR && NR <= b ' mlr_expect_fail --from $indir/abixy filter 'filter false' mlr_expect_fail --from $indir/abixy filter 'filter false; true' # ---------------------------------------------------------------- announce DSL FUNCTIONAL TESTS run_mlr filter '$x>.3' $indir/abixy run_mlr filter '$x>.3;' $indir/abixy run_mlr filter '$x>0.3' $indir/abixy run_mlr filter '$x>0.3 && $y>0.3' $indir/abixy run_mlr filter '$x>0.3 || $y>0.3' $indir/abixy run_mlr filter 'NR>=4 && NR <= 7' $indir/abixy run_mlr filter -x '$x>.3' $indir/abixy run_mlr filter -x '$x>0.3' $indir/abixy run_mlr filter -x '$x>0.3 && $y>0.3' $indir/abixy run_mlr filter -x '$x>0.3 || $y>0.3' $indir/abixy run_mlr filter -x 'NR>=4 && NR <= 7' $indir/abixy run_mlr filter '$nosuchfield>.3' $indir/abixy run_mlr put '$x2 = $x**2' $indir/abixy run_mlr put '$x2 = $x**2;' $indir/abixy run_mlr put '$z = -0.024*$x+0.13' $indir/abixy run_mlr put '$c = $a . $b' $indir/abixy run_mlr put '$ii = $i + $i' $indir/abixy run_mlr put '$emptytest = $i + $nosuch' $indir/abixy run_mlr --opprint put '$nr=NR;$fnr=FNR;$nf=NF;$filenum=FILENUM' $indir/abixy $indir/abixy run_mlr --opprint put '$y=madd($x,10,37)' then put '$z=msub($x,10,37)' $indir/modarith.dat run_mlr --opprint put '$y=mexp($x,35,37)' then put '$z=mmul($x,$y,37)' $indir/modarith.dat run_mlr put '$z=min($x, $y)' $indir/minmax.dkvp run_mlr put '$z=max($x, $y)' $indir/minmax.dkvp echo 'x=1,y=2,z=3' | run_mlr put '$o=min()' echo 'x=1,y=2,z=3' | run_mlr put '$o=max()' echo 'x=1,y=2,z=3' | run_mlr put '$o=min($x)' echo 'x=1,y=2,z=3' | run_mlr put '$o=max($x)' echo 'x=1,y=2,z=3' | run_mlr put '$o=min($x,$y)' echo 'x=1,y=2,z=3' | run_mlr put '$o=max($x,$y)' echo 'x=1,y=2,z=3' | run_mlr put '$o=min($x,$y,$z)' echo 'x=1,y=2,z=3' | run_mlr put '$o=max($x,$y,$z)' run_mlr --icsvlite --oxtab put '${x+y} = ${name.x} + ${name.y}; ${x*y} = ${name.x} * ${name.y}' $indir/braced.csv run_mlr --icsvlite --oxtab filter '${name.y} < ${z}' $indir/braced.csv run_mlr --opprint put '$z = $x < 0.5 ? 0 : 1' $indir/abixy run_mlr --csvlite filter 'true && true' $indir/b.csv run_mlr --csvlite filter 'true && false' $indir/b.csv run_mlr --csvlite filter 'false && true' $indir/b.csv run_mlr --csvlite filter 'false && false' $indir/b.csv run_mlr --csvlite filter 'true || true' $indir/b.csv run_mlr --csvlite filter 'true || false' $indir/b.csv run_mlr --csvlite filter 'false || true' $indir/b.csv run_mlr --csvlite filter 'false || false' $indir/b.csv run_mlr --csvlite filter 'true ^^ true' $indir/b.csv run_mlr --csvlite filter 'true ^^ false' $indir/b.csv run_mlr --csvlite filter 'false ^^ true' $indir/b.csv run_mlr --csvlite filter 'false ^^ false' $indir/b.csv # This tests boolean short-circuiting run_mlr put '$x==2 && $a =~ "....." { $y=4 }' $indir/short-circuit.dkvp export X=97 export Y=98 run_mlr put '$x = ENV["X"]; $y = ENV[$name]' $indir/env-var.dkvp export X= export Y= run_mlr put '$x = ENV["X"]; $y = ENV[$name]' $indir/env-var.dkvp run_mlr -n put 'begin{ENV["HOME"]="foobar"} end{print ENV["HOME"]}' # ---------------------------------------------------------------- announce DSL NULL/EMPTY HANDLING run_mlr put '$z = $s . $s' $indir/null-vs-empty.dkvp run_mlr put '$z = $s == ""' $indir/null-vs-empty.dkvp run_mlr put '$z = $s == $s' $indir/null-vs-empty.dkvp run_mlr put '$z = isempty($s)' $indir/null-vs-empty.dkvp run_mlr put '$z = $x + $y' $indir/null-vs-empty.dkvp run_mlr put '$z = $y + $y' $indir/null-vs-empty.dkvp run_mlr put '$z = $x + $nosuch' $indir/null-vs-empty.dkvp run_mlr put '$t = sub($s, "ell", "X")' $indir/null-vs-empty.dkvp run_mlr put '$t = sub($s, "ell", "")' $indir/null-vs-empty.dkvp run_mlr put '$t = sub($nosuch, "ell", "X")' $indir/null-vs-empty.dkvp run_mlr put '$t = gsub($s, "l", "X")' $indir/null-vs-empty.dkvp run_mlr put '$t = gsub($s, "l", "")' $indir/null-vs-empty.dkvp run_mlr put '$t = gsub($nosuch, "l", "X")' $indir/null-vs-empty.dkvp run_mlr --opprint filter 'isnull($x)' $indir/nullvals.dkvp run_mlr --opprint filter 'isnull($y)' $indir/nullvals.dkvp run_mlr --opprint filter 'isnull($z)' $indir/nullvals.dkvp run_mlr --opprint filter 'isnull($nosuch)' $indir/nullvals.dkvp run_mlr --opprint filter 'isnotnull($x)' $indir/nullvals.dkvp run_mlr --opprint filter 'isnotnull($y)' $indir/nullvals.dkvp run_mlr --opprint filter 'isnotnull($z)' $indir/nullvals.dkvp run_mlr --opprint filter 'isnotnull($nosuch)' $indir/nullvals.dkvp run_mlr --opprint put '$f=isnull($x)' $indir/nullvals.dkvp run_mlr --opprint put '$f=isnull($y)' $indir/nullvals.dkvp run_mlr --opprint put '$f=isnull($z)' $indir/nullvals.dkvp run_mlr --opprint put '$f=isnull($nosuch)' $indir/nullvals.dkvp run_mlr --opprint put '$f=isnull(@nosuch)' $indir/nullvals.dkvp run_mlr --opprint put '@somesuch=1;$f=isnull(@somesuch)' $indir/nullvals.dkvp run_mlr --opprint put '$f=isnotnull($x)' $indir/nullvals.dkvp run_mlr --opprint put '$f=isnotnull($y)' $indir/nullvals.dkvp run_mlr --opprint put '$f=isnotnull($z)' $indir/nullvals.dkvp run_mlr --opprint put '$f=isnotnull($nosuch)' $indir/nullvals.dkvp run_mlr --opprint put '$f=isnotnull(@nosuch)' $indir/nullvals.dkvp run_mlr --opprint put '@somesuch=1;$f=isnotnull(@somesuch)' $indir/nullvals.dkvp run_mlr --opprint filter 'isabsent($x)' $indir/nullvals.dkvp run_mlr --opprint filter 'isabsent($y)' $indir/nullvals.dkvp run_mlr --opprint filter 'isabsent($z)' $indir/nullvals.dkvp run_mlr --opprint filter 'isabsent($nosuch)' $indir/nullvals.dkvp run_mlr --opprint filter 'ispresent($x)' $indir/nullvals.dkvp run_mlr --opprint filter 'ispresent($y)' $indir/nullvals.dkvp run_mlr --opprint filter 'ispresent($z)' $indir/nullvals.dkvp run_mlr --opprint filter 'ispresent($nosuch)' $indir/nullvals.dkvp run_mlr --opprint put '$f=isabsent($x)' $indir/nullvals.dkvp run_mlr --opprint put '$f=isabsent($y)' $indir/nullvals.dkvp run_mlr --opprint put '$f=isabsent($z)' $indir/nullvals.dkvp run_mlr --opprint put '$f=isabsent($nosuch)' $indir/nullvals.dkvp run_mlr --opprint put '$f=isabsent(@nosuch)' $indir/nullvals.dkvp run_mlr --opprint put '@somesuch=1;$f=isabsent(@somesuch)' $indir/nullvals.dkvp run_mlr --opprint put '$f=ispresent($x)' $indir/nullvals.dkvp run_mlr --opprint put '$f=ispresent($y)' $indir/nullvals.dkvp run_mlr --opprint put '$f=ispresent($z)' $indir/nullvals.dkvp run_mlr --opprint put '$f=ispresent($nosuch)' $indir/nullvals.dkvp run_mlr --opprint put '$f=ispresent(@nosuch)' $indir/nullvals.dkvp run_mlr --opprint put '@somesuch=1;$f=ispresent(@somesuch)' $indir/nullvals.dkvp run_mlr --opprint filter 'isempty($x)' $indir/nullvals.dkvp run_mlr --opprint filter 'isempty($y)' $indir/nullvals.dkvp run_mlr --opprint filter 'isempty($z)' $indir/nullvals.dkvp run_mlr --opprint filter 'isempty($nosuch)' $indir/nullvals.dkvp run_mlr --opprint filter 'isnotempty($x)' $indir/nullvals.dkvp run_mlr --opprint filter 'isnotempty($y)' $indir/nullvals.dkvp run_mlr --opprint filter 'isnotempty($z)' $indir/nullvals.dkvp run_mlr --opprint filter 'isnotempty($nosuch)' $indir/nullvals.dkvp run_mlr --opprint put '$f=isempty($x)' $indir/nullvals.dkvp run_mlr --opprint put '$f=isempty($y)' $indir/nullvals.dkvp run_mlr --opprint put '$f=isempty($z)' $indir/nullvals.dkvp run_mlr --opprint put '$f=isempty($nosuch)' $indir/nullvals.dkvp run_mlr --opprint put '$f=isempty(@nosuch)' $indir/nullvals.dkvp run_mlr --opprint put '@somesuch=1;$f=isempty(@somesuch)' $indir/nullvals.dkvp run_mlr --opprint put '$f=isnotempty($x)' $indir/nullvals.dkvp run_mlr --opprint put '$f=isnotempty($y)' $indir/nullvals.dkvp run_mlr --opprint put '$f=isnotempty($z)' $indir/nullvals.dkvp run_mlr --opprint put '$f=isnotempty($nosuch)' $indir/nullvals.dkvp run_mlr --opprint put '$f=isnotempty(@nosuch)' $indir/nullvals.dkvp run_mlr --opprint put '@somesuch=1;$f=isnotempty(@somesuch)' $indir/nullvals.dkvp run_mlr put -q '@v=1; @nonesuch {emit @v}' $indir/abixy run_mlr put -q '@v=1; @nonesuch==true {emit @v}' $indir/abixy run_mlr put -q '@v=1; $nonesuch {emit @v}' $indir/abixy run_mlr put -q '@v=1; $nonesuch==true {emit @v}' $indir/abixy mention PLUS run_mlr --ofs tab put 'begin{}; $xy = $x + $y; $sy = @s + $y; $xt = $x + @t; $st = @s + @t' $indir/typeof.dkvp run_mlr --ofs tab put 'begin{@s=3}; $xy = $x + $y; $sy = @s + $y; $xt = $x + @t; $st = @s + @t' $indir/typeof.dkvp run_mlr --ofs tab put 'begin{@t=4}; $xy = $x + $y; $sy = @s + $y; $xt = $x + @t; $st = @s + @t' $indir/typeof.dkvp run_mlr --ofs tab put 'begin{@s=3;@t=4}; $xy = $x + $y; $sy = @s + $y; $xt = $x + @t; $st = @s + @t' $indir/typeof.dkvp mention MINUS run_mlr --ofs tab put 'begin{}; $xy = $x - $y; $sy = @s - $y; $xt = $x - @t; $st = @s - @t' $indir/typeof.dkvp run_mlr --ofs tab put 'begin{@s=3}; $xy = $x - $y; $sy = @s - $y; $xt = $x - @t; $st = @s - @t' $indir/typeof.dkvp run_mlr --ofs tab put 'begin{@t=4}; $xy = $x - $y; $sy = @s - $y; $xt = $x - @t; $st = @s - @t' $indir/typeof.dkvp run_mlr --ofs tab put 'begin{@s=3;@t=4}; $xy = $x - $y; $sy = @s - $y; $xt = $x - @t; $st = @s - @t' $indir/typeof.dkvp mention TIMES run_mlr --ofs tab put 'begin{}; $xy = $x * $y; $sy = @s * $y; $xt = $x * @t; $st = @s * @t' $indir/typeof.dkvp run_mlr --ofs tab put 'begin{@s=3}; $xy = $x * $y; $sy = @s * $y; $xt = $x * @t; $st = @s * @t' $indir/typeof.dkvp run_mlr --ofs tab put 'begin{@t=4}; $xy = $x * $y; $sy = @s * $y; $xt = $x * @t; $st = @s * @t' $indir/typeof.dkvp run_mlr --ofs tab put 'begin{@s=3;@t=4}; $xy = $x * $y; $sy = @s * $y; $xt = $x * @t; $st = @s * @t' $indir/typeof.dkvp mention DIVIDE run_mlr --ofs tab put 'begin{}; $xy = $x / $y; $sy = @s / $y; $xt = $x / @t; $st = @s / @t' $indir/typeof.dkvp run_mlr --ofs tab put 'begin{@s=3}; $xy = $x / $y; $sy = @s / $y; $xt = $x / @t; $st = @s / @t' $indir/typeof.dkvp run_mlr --ofs tab put 'begin{@t=4}; $xy = $x / $y; $sy = @s / $y; $xt = $x / @t; $st = @s / @t' $indir/typeof.dkvp run_mlr --ofs tab put 'begin{@s=3;@t=4}; $xy = $x / $y; $sy = @s / $y; $xt = $x / @t; $st = @s / @t' $indir/typeof.dkvp mention INTEGER DIVIDE run_mlr --ofs tab put 'begin{}; $xy = $x // $y; $sy = @s // $y; $xt = $x // @t; $st = @s // @t' $indir/typeof.dkvp run_mlr --ofs tab put 'begin{@s=3}; $xy = $x // $y; $sy = @s // $y; $xt = $x // @t; $st = @s // @t' $indir/typeof.dkvp run_mlr --ofs tab put 'begin{@t=4}; $xy = $x // $y; $sy = @s // $y; $xt = $x // @t; $st = @s // @t' $indir/typeof.dkvp run_mlr --ofs tab put 'begin{@s=3;@t=4}; $xy = $x // $y; $sy = @s // $y; $xt = $x // @t; $st = @s // @t' $indir/typeof.dkvp mention REMAINDER run_mlr --ofs tab put 'begin{}; $xy = $x % $y; $sy = @s % $y; $xt = $x % @t; $st = @s % @t' $indir/typeof.dkvp run_mlr --ofs tab put 'begin{@s=3}; $xy = $x % $y; $sy = @s % $y; $xt = $x % @t; $st = @s % @t' $indir/typeof.dkvp run_mlr --ofs tab put 'begin{@t=4}; $xy = $x % $y; $sy = @s % $y; $xt = $x % @t; $st = @s % @t' $indir/typeof.dkvp run_mlr --ofs tab put 'begin{@s=3;@t=4}; $xy = $x % $y; $sy = @s % $y; $xt = $x % @t; $st = @s % @t' $indir/typeof.dkvp mention BITWISE AND run_mlr --ofs tab put 'begin{}; $xy = $x & $y; $sy = @s & $y; $xt = $x & @t; $st = @s & @t' $indir/typeof.dkvp run_mlr --ofs tab put 'begin{@s=3}; $xy = $x & $y; $sy = @s & $y; $xt = $x & @t; $st = @s & @t' $indir/typeof.dkvp run_mlr --ofs tab put 'begin{@t=4}; $xy = $x & $y; $sy = @s & $y; $xt = $x & @t; $st = @s & @t' $indir/typeof.dkvp run_mlr --ofs tab put 'begin{@s=3;@t=4}; $xy = $x & $y; $sy = @s & $y; $xt = $x & @t; $st = @s & @t' $indir/typeof.dkvp mention BITWISE OR run_mlr --ofs tab put 'begin{}; $xy = $x | $y; $sy = @s | $y; $xt = $x | @t; $st = @s | @t' $indir/typeof.dkvp run_mlr --ofs tab put 'begin{@s=3}; $xy = $x | $y; $sy = @s | $y; $xt = $x | @t; $st = @s | @t' $indir/typeof.dkvp run_mlr --ofs tab put 'begin{@t=4}; $xy = $x | $y; $sy = @s | $y; $xt = $x | @t; $st = @s | @t' $indir/typeof.dkvp run_mlr --ofs tab put 'begin{@s=3;@t=4}; $xy = $x | $y; $sy = @s | $y; $xt = $x | @t; $st = @s | @t' $indir/typeof.dkvp mention BITWISE XOR run_mlr --ofs tab put 'begin{}; $xy = $x ^ $y; $sy = @s ^ $y; $xt = $x ^ @t; $st = @s ^ @t' $indir/typeof.dkvp run_mlr --ofs tab put 'begin{@s=3}; $xy = $x ^ $y; $sy = @s ^ $y; $xt = $x ^ @t; $st = @s ^ @t' $indir/typeof.dkvp run_mlr --ofs tab put 'begin{@t=4}; $xy = $x ^ $y; $sy = @s ^ $y; $xt = $x ^ @t; $st = @s ^ @t' $indir/typeof.dkvp run_mlr --ofs tab put 'begin{@s=3;@t=4}; $xy = $x ^ $y; $sy = @s ^ $y; $xt = $x ^ @t; $st = @s ^ @t' $indir/typeof.dkvp # ---------------------------------------------------------------- announce DSL TYPE PREDICATES run_mlr --from $indir/abixy --opprint put ' for (k, v in $*) { $[k."_type"] = typeof(v) } ' run_mlr --from $indir/abixy-het put -q 'for (k,v in $*) {if (isfloat(v)) {@float[NR][k] = v}} end{ emit @float, "NR", "k" }' run_mlr --from $indir/abixy-het put -q 'for (k,v in $*) {if (isint(v)) {@int[NR][k] = v}} end{ emit @int, "NR", "k" }' run_mlr --from $indir/abixy-het put -q 'for (k,v in $*) {if (isnumeric(v)) {@numeric[NR][k] = v}} end{ emit @numeric, "NR", "k" }' run_mlr --from $indir/abixy-het put -q 'for (k,v in $*) {if (isstring(v)) {@string[NR][k] = v}} end{ emit @string, "NR", "k" }' run_mlr --from $indir/abixy-het put -q 'for (k,v in $*) {if (isbool(v)) {@bool[NR][k] = v}} end{ emit @bool, "NR", "k" }' run_mlr --from $indir/abixy-het put -q 'for (k,v in $*) {if (isbool(NR==2)) {@bool[NR][k] = "NR==2"}} end{ emit @bool, "NR", "k" }' # ---------------------------------------------------------------- announce DSL TYPE-INFERENCE run_mlr --xtab put '$y = $pi1 + $pi2' $indir/mixed-types.xtab run_mlr --xtab put -F '$y = $pi1 + $pi2' $indir/mixed-types.xtab run_mlr --xtab put -S '$y = $pi1 . $pi2' $indir/mixed-types.xtab run_mlr --xtab filter '999 != $pi1 + $pi2' $indir/mixed-types.xtab run_mlr --xtab filter -F '999 != $pi1 + $pi2' $indir/mixed-types.xtab run_mlr --xtab filter -S '"999" != $pi1 . $pi2' $indir/mixed-types.xtab run_mlr --xtab put '$y=abs($pf1)' $indir/mixed-types.xtab run_mlr --xtab put '$y=abs($nf1)' $indir/mixed-types.xtab run_mlr --xtab put '$y=abs($zf)' $indir/mixed-types.xtab run_mlr --xtab put '$y=abs($pi1)' $indir/mixed-types.xtab run_mlr --xtab put '$y=abs($ni1)' $indir/mixed-types.xtab run_mlr --xtab put '$y=abs($zi)' $indir/mixed-types.xtab run_mlr --xtab put -F '$y=abs($pf1)' $indir/mixed-types.xtab run_mlr --xtab put -F '$y=abs($nf1)' $indir/mixed-types.xtab run_mlr --xtab put -F '$y=abs($zf)' $indir/mixed-types.xtab run_mlr --xtab put -F '$y=abs($pi1)' $indir/mixed-types.xtab run_mlr --xtab put -F '$y=abs($ni1)' $indir/mixed-types.xtab run_mlr --xtab put -F '$y=abs($zi)' $indir/mixed-types.xtab run_mlr --xtab put '$y=ceil($pf1)' $indir/mixed-types.xtab run_mlr --xtab put '$y=ceil($nf1)' $indir/mixed-types.xtab run_mlr --xtab put '$y=ceil($zf)' $indir/mixed-types.xtab run_mlr --xtab put '$y=ceil($pi1)' $indir/mixed-types.xtab run_mlr --xtab put '$y=ceil($ni1)' $indir/mixed-types.xtab run_mlr --xtab put '$y=ceil($zi)' $indir/mixed-types.xtab run_mlr --xtab put -F '$y=floor($pf1)' $indir/mixed-types.xtab run_mlr --xtab put -F '$y=floor($nf1)' $indir/mixed-types.xtab run_mlr --xtab put -F '$y=floor($zf)' $indir/mixed-types.xtab run_mlr --xtab put -F '$y=floor($pi1)' $indir/mixed-types.xtab run_mlr --xtab put -F '$y=floor($ni1)' $indir/mixed-types.xtab run_mlr --xtab put -F '$y=floor($zi)' $indir/mixed-types.xtab run_mlr --xtab put '$y=round($pf1)' $indir/mixed-types.xtab run_mlr --xtab put '$y=round($nf1)' $indir/mixed-types.xtab run_mlr --xtab put '$y=round($zf)' $indir/mixed-types.xtab run_mlr --xtab put '$y=round($pi1)' $indir/mixed-types.xtab run_mlr --xtab put '$y=round($ni1)' $indir/mixed-types.xtab run_mlr --xtab put '$y=round($zi)' $indir/mixed-types.xtab run_mlr --xtab put -F '$y=round($pf1)' $indir/mixed-types.xtab run_mlr --xtab put -F '$y=round($nf1)' $indir/mixed-types.xtab run_mlr --xtab put -F '$y=round($zf)' $indir/mixed-types.xtab run_mlr --xtab put -F '$y=round($pi1)' $indir/mixed-types.xtab run_mlr --xtab put -F '$y=round($ni1)' $indir/mixed-types.xtab run_mlr --xtab put -F '$y=round($zi)' $indir/mixed-types.xtab run_mlr --xtab put '$y=sgn($pf1)' $indir/mixed-types.xtab run_mlr --xtab put '$y=sgn($nf1)' $indir/mixed-types.xtab run_mlr --xtab put '$y=sgn($zf)' $indir/mixed-types.xtab run_mlr --xtab put '$y=sgn($pi1)' $indir/mixed-types.xtab run_mlr --xtab put '$y=sgn($ni1)' $indir/mixed-types.xtab run_mlr --xtab put '$y=sgn($zi)' $indir/mixed-types.xtab run_mlr --xtab put -F '$y=sgn($pf1)' $indir/mixed-types.xtab run_mlr --xtab put -F '$y=sgn($nf1)' $indir/mixed-types.xtab run_mlr --xtab put -F '$y=sgn($zf)' $indir/mixed-types.xtab run_mlr --xtab put -F '$y=sgn($pi1)' $indir/mixed-types.xtab run_mlr --xtab put -F '$y=sgn($ni1)' $indir/mixed-types.xtab run_mlr --xtab put -F '$y=sgn($zi)' $indir/mixed-types.xtab run_mlr --xtab put '$min=min($pf1,$pf2);$max=max($pf1,$pf2)' $indir/mixed-types.xtab run_mlr --xtab put '$min=min($pf1,$pi2);$max=max($pf1,$pi2)' $indir/mixed-types.xtab run_mlr --xtab put '$min=min($pi1,$pf2);$max=max($pi1,$pf2)' $indir/mixed-types.xtab run_mlr --xtab put '$min=min($pi1,$pi2);$max=max($pi1,$pi2)' $indir/mixed-types.xtab run_mlr --xtab put -F '$min=min($pf1,$pf2);$max=max($pf1,$pf2)' $indir/mixed-types.xtab run_mlr --xtab put -F '$min=min($pf1,$pi2);$max=max($pf1,$pi2)' $indir/mixed-types.xtab run_mlr --xtab put -F '$min=min($pi1,$pf2);$max=max($pi1,$pf2)' $indir/mixed-types.xtab run_mlr --xtab put -F '$min=min($pi1,$pi2);$max=max($pi1,$pi2)' $indir/mixed-types.xtab run_mlr --xtab put '$min=min($pf1,$pf2);$max=max($pf1,$pf2)' $indir/mixed-types.xtab run_mlr --xtab put '$min=min($pf1,$pi2);$max=max($pf1,$pi2)' $indir/mixed-types.xtab run_mlr --xtab put '$min=min($pi1,$pf2);$max=max($pi1,$pf2)' $indir/mixed-types.xtab run_mlr --xtab put '$min=min($pi1,$pi2);$max=max($pi1,$pi2)' $indir/mixed-types.xtab run_mlr --xtab put -F '$min=min($pf1,$pf2);$max=max($pf1,$pf2)' $indir/mixed-types.xtab run_mlr --xtab put -F '$min=min($pf1,$pi2);$max=max($pf1,$pi2)' $indir/mixed-types.xtab run_mlr --xtab put -F '$min=min($pi1,$pf2);$max=max($pi1,$pf2)' $indir/mixed-types.xtab run_mlr --xtab put -F '$min=min($pi1,$pi2);$max=max($pi1,$pi2)' $indir/mixed-types.xtab run_mlr --xtab put '$sum=$pf1+$pf2;$diff=$pf1-$pf2' $indir/mixed-types.xtab run_mlr --xtab put '$sum=$pf1+$pi2;$diff=$pf1-$pi2' $indir/mixed-types.xtab run_mlr --xtab put '$sum=$pi1+$pf2;$diff=$pi1-$pf2' $indir/mixed-types.xtab run_mlr --xtab put '$sum=$pi1+$pi2;$diff=$pi1-$pi2' $indir/mixed-types.xtab run_mlr --xtab put -F '$sum=$pf1+$pf2;$diff=$pf1-$pf2' $indir/mixed-types.xtab run_mlr --xtab put -F '$sum=$pf1+$pi2;$diff=$pf1-$pi2' $indir/mixed-types.xtab run_mlr --xtab put -F '$sum=$pi1+$pf2;$diff=$pi1-$pf2' $indir/mixed-types.xtab run_mlr --xtab put -F '$sum=$pi1+$pi2;$diff=$pi1-$pi2' $indir/mixed-types.xtab run_mlr --xtab put '$prod=$pf1*$pf2;$quot=$pf1/$pf2' $indir/mixed-types.xtab run_mlr --xtab put '$prod=$pf1*$pi2;$quot=$pf1/$pi2' $indir/mixed-types.xtab run_mlr --xtab put '$prod=$pi1*$pf2;$quot=$pi1/$pf2' $indir/mixed-types.xtab run_mlr --xtab put '$prod=$pi1*$pi2;$quot=$pi1/$pi2' $indir/mixed-types.xtab run_mlr --xtab put -F '$prod=$pf1*$pf2;$quot=$pf1/$pf2' $indir/mixed-types.xtab run_mlr --xtab put -F '$prod=$pf1*$pi2;$quot=$pf1/$pi2' $indir/mixed-types.xtab run_mlr --xtab put -F '$prod=$pi1*$pf2;$quot=$pi1/$pf2' $indir/mixed-types.xtab run_mlr --xtab put -F '$prod=$pi1*$pi2;$quot=$pi1/$pi2' $indir/mixed-types.xtab run_mlr --xtab put '$iquot=$pf1//$pf2;$mod=$pf1%$pf2' $indir/mixed-types.xtab run_mlr --xtab put '$iquot=$pf1//$pi2;$mod=$pf1%$pi2' $indir/mixed-types.xtab run_mlr --xtab put '$iquot=$pi1//$pf2;$mod=$pi1%$pf2' $indir/mixed-types.xtab run_mlr --xtab put '$iquot=$pi1//$pi2;$mod=$pi1%$pi2' $indir/mixed-types.xtab run_mlr --xtab put -F '$iquot=$pf1//$pf2;$mod=$pf1%$pf2' $indir/mixed-types.xtab run_mlr --xtab put -F '$iquot=$pf1//$pi2;$mod=$pf1%$pi2' $indir/mixed-types.xtab run_mlr --xtab put -F '$iquot=$pi1//$pf2;$mod=$pi1%$pf2' $indir/mixed-types.xtab run_mlr --xtab put -F '$iquot=$pi1//$pi2;$mod=$pi1%$pi2' $indir/mixed-types.xtab run_mlr --xtab put '$a=roundm($pf1,10.0);$b=roundm($pf1,-10.0)' $indir/mixed-types.xtab run_mlr --xtab put '$a=roundm($pf1,10) ;$b=roundm($pf1,-10) ' $indir/mixed-types.xtab run_mlr --xtab put '$a=roundm($pi1,10.0);$b=roundm($pi1,-10.0)' $indir/mixed-types.xtab run_mlr --xtab put '$a=roundm($pi1,10) ;$b=roundm($pi1,-10) ' $indir/mixed-types.xtab echo 'x=3,y=4' | run_mlr --oxtab put '$z=$x+$y; $a=3+4; $b="3"."4"; $c="3"+4' # ---------------------------------------------------------------- announce DSL SCIENTIFIC NOTATION IN FIELD VALUES run_mlr --opprint put '$y=$x+1' $indir/scinot.dkvp # ---------------------------------------------------------------- announce DSL SCIENTIFIC NOTATION IN EXPRESSION LITERALS run_mlr --opprint put '$y = 123 + $i' $indir/scinot1.dkvp run_mlr --opprint put '$y = 123. + $i' $indir/scinot1.dkvp run_mlr --opprint put '$y = 123.4 + $i' $indir/scinot1.dkvp run_mlr --opprint put '$y = .234 + $i' $indir/scinot1.dkvp run_mlr --opprint put '$y = 1e2 + $i' $indir/scinot1.dkvp run_mlr --opprint put '$y = 1e-2 + $i' $indir/scinot1.dkvp run_mlr --opprint put '$y = 1.2e3 + $i' $indir/scinot1.dkvp run_mlr --opprint put '$y = 1.e3 + $i' $indir/scinot1.dkvp run_mlr --opprint put '$y = 1.2e-3 + $i' $indir/scinot1.dkvp run_mlr --opprint put '$y = 1.e-3 + $i' $indir/scinot1.dkvp run_mlr --opprint put '$y = .2e3 + $i' $indir/scinot1.dkvp run_mlr --opprint put '$y = .2e-3 + $i' $indir/scinot1.dkvp run_mlr --opprint put '$y = 1.e-3 + $i' $indir/scinot1.dkvp run_mlr --opprint put '$y = -123 + $i' $indir/scinot1.dkvp run_mlr --opprint put '$y = -123. + $i' $indir/scinot1.dkvp run_mlr --opprint put '$y = -123.4 + $i' $indir/scinot1.dkvp run_mlr --opprint put '$y = -.234 + $i' $indir/scinot1.dkvp run_mlr --opprint put '$y = -1e2 + $i' $indir/scinot1.dkvp run_mlr --opprint put '$y = -1e-2 + $i' $indir/scinot1.dkvp run_mlr --opprint put '$y = -1.2e3 + $i' $indir/scinot1.dkvp run_mlr --opprint put '$y = -1.e3 + $i' $indir/scinot1.dkvp run_mlr --opprint put '$y = -1.2e-3 + $i' $indir/scinot1.dkvp run_mlr --opprint put '$y = -1.e-3 + $i' $indir/scinot1.dkvp run_mlr --opprint put '$y = -.2e3 + $i' $indir/scinot1.dkvp run_mlr --opprint put '$y = -.2e-3 + $i' $indir/scinot1.dkvp run_mlr --opprint put '$y = -1.e-3 + $i' $indir/scinot1.dkvp # ---------------------------------------------------------------- announce DSL FROM-FILE FEATURE run_mlr put -f $indir/put-example.dsl $indir/abixy run_mlr filter -f $indir/filter-example.dsl $indir/abixy run_mlr --from $indir/abixy put -f $indir/put-example.dsl run_mlr --from $indir/abixy filter -f $indir/filter-example.dsl run_mlr --from $indir/abixy --from $indir/abixy-het put -f $indir/put-example.dsl run_mlr --from $indir/abixy --from $indir/abixy-het filter -f $indir/filter-example.dsl # ---------------------------------------------------------------- announce DSL MULTI-PART SCRIPTS run_mlr --opprint --from $indir/abixy put -f $indir/put-script-piece-1 run_mlr --opprint --from $indir/abixy put -f $indir/put-script-piece-1 -f $indir/put-script-piece-2 run_mlr --opprint --from $indir/abixy put -f $indir/put-script-piece-1 -f $indir/put-script-piece-2 -f $indir/put-script-piece-3 run_mlr --opprint --from $indir/abixy put -e '$xy = $x**2 + $y**2' run_mlr --opprint --from $indir/abixy filter -e 'NR == 7' run_mlr --opprint --from $indir/abixy put -e 'print "PRE";' -f $indir/put-script-piece-1 -f $indir/put-script-piece-2 -f $indir/put-script-piece-3 -e 'print "POST"' run_mlr --opprint --from $indir/abixy filter -f $indir/filter-script-piece-1 run_mlr --opprint --from $indir/abixy filter -f $indir/filter-script-piece-1 -f $indir/filter-script-piece-2 # ---------------------------------------------------------------- announce UTF-8 STRLEN run_mlr --inidx --ifs comma --oxtab put '$s1=strlen($1);$s2=strlen($2);$s3=strlen($3);$s4=strlen($4)' $indir/utf8-align.dkvp # ---------------------------------------------------------------- announce STATS1/STEP INT/FLOAT run_mlr --opprint step -a rsum,delta,counter -f x,y,z $indir/int-float.dkvp run_mlr --opprint step -F -a rsum,delta,counter -f x,y,z $indir/int-float.dkvp run_mlr --oxtab stats1 -a min,max,sum,count -f x,y,z $indir/int-float.dkvp run_mlr --oxtab stats1 -F -a min,max,sum,count -f x,y,z $indir/int-float.dkvp # ---------------------------------------------------------------- announce DSL PYTHONIC DIVISION run_mlr --xtab put '$quot=$pf1/10.0;$iquot=$pf1//10.0;$mod=$pf1%10.0' $indir/mixed-types.xtab run_mlr --xtab put '$quot=$pi1/10 ;$iquot=$pi1//10 ;$mod=$pi1%10 ' $indir/mixed-types.xtab run_mlr --xtab put '$quot=$nf1/10.0;$iquot=$nf1//10.0;$mod=$nf1%10.0' $indir/mixed-types.xtab run_mlr --xtab put '$quot=$ni1/10 ;$iquot=$ni1//10 ;$mod=$ni1%10 ' $indir/mixed-types.xtab run_mlr --xtab put -F '$quot=$pf1/10.0;$iquot=$pf1//10.0;$mod=$pf1%10.0' $indir/mixed-types.xtab run_mlr --xtab put -F '$quot=$pi1/10 ;$iquot=$pi1//10 ;$mod=$pi1%10 ' $indir/mixed-types.xtab run_mlr --xtab put -F '$quot=$nf1/10.0;$iquot=$nf1//10.0;$mod=$nf1%10.0' $indir/mixed-types.xtab run_mlr --xtab put -F '$quot=$ni1/10 ;$iquot=$ni1//10 ;$mod=$ni1%10 ' $indir/mixed-types.xtab run_mlr --xtab put '$quot=$pf1/-10.0;$iquot=$pf1//-10.0;$mod=$pf1%-10.0' $indir/mixed-types.xtab run_mlr --xtab put '$quot=$pi1/-10 ;$iquot=$pi1//-10 ;$mod=$pi1%-10 ' $indir/mixed-types.xtab run_mlr --xtab put '$quot=$nf1/-10.0;$iquot=$nf1//-10.0;$mod=$nf1%-10.0' $indir/mixed-types.xtab run_mlr --xtab put '$quot=$ni1/-10 ;$iquot=$ni1//-10 ;$mod=$ni1%-10 ' $indir/mixed-types.xtab run_mlr --xtab put -F '$quot=$pf1/-10.0;$iquot=$pf1//-10.0;$mod=$pf1%-10.0' $indir/mixed-types.xtab run_mlr --xtab put -F '$quot=$pi1/-10 ;$iquot=$pi1//-10 ;$mod=$pi1%-10 ' $indir/mixed-types.xtab run_mlr --xtab put -F '$quot=$nf1/-10.0;$iquot=$nf1//-10.0;$mod=$nf1%-10.0' $indir/mixed-types.xtab run_mlr --xtab put -F '$quot=$ni1/-10 ;$iquot=$ni1//-10 ;$mod=$ni1%-10 ' $indir/mixed-types.xtab # ---------------------------------------------------------------- announce DSL REGEX MATCHING run_mlr filter -v '$x =~ "bcd"' $indir/regex.dkvp run_mlr filter -v '$x =~ "^bcd"' $indir/regex.dkvp run_mlr filter -v '$x =~ "^abc"' $indir/regex.dkvp run_mlr filter -v '$x =~ "^abc$"' $indir/regex.dkvp run_mlr filter -v '$x =~ "^a.*d$"' $indir/regex.dkvp run_mlr filter -v '$x =~ "^a.*"."d$"' $indir/regex.dkvp run_mlr filter -v '$y =~ "\".."' $indir/regex.dkvp run_mlr filter -v '$x =~ "bcd"i' $indir/regex.dkvp run_mlr filter -v '$x =~ "^bcd"i' $indir/regex.dkvp run_mlr filter -v '$x =~ "^abc"i' $indir/regex.dkvp run_mlr filter -v '$x =~ "^abc$"i' $indir/regex.dkvp run_mlr filter -v '$x =~ "^a.*d$"i' $indir/regex.dkvp run_mlr filter -v '$x =~ "^a.*"."d$"i' $indir/regex.dkvp # ---------------------------------------------------------------- announce DSL TYPED OVERLAY run_mlr put '$y = string($x); $z=$y.$y' $indir/int-float.dkvp run_mlr put '$z=string($x).string($x)' $indir/int-float.dkvp run_mlr put '$y = string($x)' then put '$z=$y.$y' $indir/int-float.dkvp run_mlr put '$a="hello"' then put '$b=$a." world";$z=$x+$y;$c=$b;$a=sub($b,"hello","farewell")' $indir/int-float.dkvp # ---------------------------------------------------------------- announce DSL REGEX CAPTURES # cat reg_test/input/capture.dkvp # FIELD=ABC123 # FIELD=ABC..123 # FIELD=..ABC..123.. # FIELD=none of the above run_mlr --opprint put '$FIELD =~ "([A-Z]+)([0-9]+)"; $F1="\1"; $F2="\2"; $F3="\3"' $indir/capture.dkvp run_mlr --opprint put '$FIELD =~ "([A-Z]+)[^0-9]*([0-9]+)"; $F1="\1"; $F2="\2"; $F3="\3"' $indir/capture.dkvp run_mlr --opprint put '$FIELD =~ "([A-Z]+)([0-9]+)"' then put '$F1="\1"; $F2="\2"; $F3="\3"' $indir/capture.dkvp run_mlr --opprint put '$FIELD =~ "([A-Z]+)[^0-9]*([0-9]+)"' then put '$F1="\1"; $F2="\2"; $F3="\3"' $indir/capture.dkvp # cat reg_test/input/capture-lengths.dkvp # FIELD= # FIELD=a # FIELD=ab # FIELD=abc # FIELD=abcd # FIELD=abcde # FIELD=abcdef # FIELD=abcdefg # FIELD=abcdefgh # FIELD=abcdefghi # FIELD=abcdefghij # FIELD=abcdefghijk # FIELD=abcdefghijkl run_mlr --opprint put ' $FIELD =~ "....."; $F0="\0";$F1="\1";$F2="\2";$F3="\3";$F4="\4";$F5="\5";$F6="\6";$F7="\7";$F8="\8";$F9="\9"' $indir/capture-lengths.dkvp run_mlr --opprint put ' $FIELD =~ "....." {$F0="\0";$F1="\1";$F2="\2";$F3="\3";$F4="\4";$F5="\5";$F6="\6";$F7="\7";$F8="\8";$F9="\9"}' $indir/capture-lengths.dkvp run_mlr --opprint put 'filter $FIELD =~ "....."; $F0="\0";$F1="\1";$F2="\2";$F3="\3";$F4="\4";$F5="\5";$F6="\6";$F7="\7";$F8="\8";$F9="\9"' $indir/capture-lengths.dkvp run_mlr --opprint put '$FIELD =~ "(.)"; $F0="\0";$F1="\1";$F2="\2";$F3="\3";$F4="\4";$F5="\5";$F6="\6";$F7="\7";$F8="\8";$F9="\9"' $indir/capture-lengths.dkvp run_mlr --opprint put '$FIELD =~ "(.)(.)"; $F0="\0";$F1="\1";$F2="\2";$F3="\3";$F4="\4";$F5="\5";$F6="\6";$F7="\7";$F8="\8";$F9="\9"' $indir/capture-lengths.dkvp run_mlr --opprint put '$FIELD =~ "(.)(.)(.)"; $F0="\0";$F1="\1";$F2="\2";$F3="\3";$F4="\4";$F5="\5";$F6="\6";$F7="\7";$F8="\8";$F9="\9"' $indir/capture-lengths.dkvp run_mlr --opprint put '$FIELD =~ "(.)(.)(.)(.)"; $F0="\0";$F1="\1";$F2="\2";$F3="\3";$F4="\4";$F5="\5";$F6="\6";$F7="\7";$F8="\8";$F9="\9"' $indir/capture-lengths.dkvp run_mlr --opprint put '$FIELD =~ "(.)(.)(.)(.)(.)"; $F0="\0";$F1="\1";$F2="\2";$F3="\3";$F4="\4";$F5="\5";$F6="\6";$F7="\7";$F8="\8";$F9="\9"' $indir/capture-lengths.dkvp run_mlr --opprint put '$FIELD =~ "(.)(.)(.)(.)(.)(.)"; $F0="\0";$F1="\1";$F2="\2";$F3="\3";$F4="\4";$F5="\5";$F6="\6";$F7="\7";$F8="\8";$F9="\9"' $indir/capture-lengths.dkvp run_mlr --opprint put '$FIELD =~ "(.)(.)(.)(.)(.)(.)(.)"; $F0="\0";$F1="\1";$F2="\2";$F3="\3";$F4="\4";$F5="\5";$F6="\6";$F7="\7";$F8="\8";$F9="\9"' $indir/capture-lengths.dkvp run_mlr --opprint put '$FIELD =~ "(.)(.)(.)(.)(.)(.)(.)(.)"; $F0="\0";$F1="\1";$F2="\2";$F3="\3";$F4="\4";$F5="\5";$F6="\6";$F7="\7";$F8="\8";$F9="\9"' $indir/capture-lengths.dkvp run_mlr --opprint put '$FIELD =~ "(.)(.)(.)(.)(.)(.)(.)(.)(.)"; $F0="\0";$F1="\1";$F2="\2";$F3="\3";$F4="\4";$F5="\5";$F6="\6";$F7="\7";$F8="\8";$F9="\9"' $indir/capture-lengths.dkvp run_mlr --opprint put '$FIELD =~ "(.)(.)(.)(.)(.)(.)(.)(.)(.)(.)"; $F0="\0";$F1="\1";$F2="\2";$F3="\3";$F4="\4";$F5="\5";$F6="\6";$F7="\7";$F8="\8";$F9="\9"' $indir/capture-lengths.dkvp run_mlr --opprint put '$FIELD =~ "(.)" {$F0="\0";$F1="\1";$F2="\2";$F3="\3";$F4="\4";$F5="\5";$F6="\6";$F7="\7";$F8="\8";$F9="\9"}' $indir/capture-lengths.dkvp run_mlr --opprint put '$FIELD =~ "(.)(.)" {$F0="\0";$F1="\1";$F2="\2";$F3="\3";$F4="\4";$F5="\5";$F6="\6";$F7="\7";$F8="\8";$F9="\9"}' $indir/capture-lengths.dkvp run_mlr --opprint put '$FIELD =~ "(.)(.)(.)" {$F0="\0";$F1="\1";$F2="\2";$F3="\3";$F4="\4";$F5="\5";$F6="\6";$F7="\7";$F8="\8";$F9="\9"}' $indir/capture-lengths.dkvp run_mlr --opprint put '$FIELD =~ "(.)(.)(.)(.)" {$F0="\0";$F1="\1";$F2="\2";$F3="\3";$F4="\4";$F5="\5";$F6="\6";$F7="\7";$F8="\8";$F9="\9"}' $indir/capture-lengths.dkvp run_mlr --opprint put '$FIELD =~ "(.)(.)(.)(.)(.)" {$F0="\0";$F1="\1";$F2="\2";$F3="\3";$F4="\4";$F5="\5";$F6="\6";$F7="\7";$F8="\8";$F9="\9"}' $indir/capture-lengths.dkvp run_mlr --opprint put '$FIELD =~ "(.)(.)(.)(.)(.)(.)" {$F0="\0";$F1="\1";$F2="\2";$F3="\3";$F4="\4";$F5="\5";$F6="\6";$F7="\7";$F8="\8";$F9="\9"}' $indir/capture-lengths.dkvp run_mlr --opprint put '$FIELD =~ "(.)(.)(.)(.)(.)(.)(.)" {$F0="\0";$F1="\1";$F2="\2";$F3="\3";$F4="\4";$F5="\5";$F6="\6";$F7="\7";$F8="\8";$F9="\9"}' $indir/capture-lengths.dkvp run_mlr --opprint put '$FIELD =~ "(.)(.)(.)(.)(.)(.)(.)(.)" {$F0="\0";$F1="\1";$F2="\2";$F3="\3";$F4="\4";$F5="\5";$F6="\6";$F7="\7";$F8="\8";$F9="\9"}' $indir/capture-lengths.dkvp run_mlr --opprint put '$FIELD =~ "(.)(.)(.)(.)(.)(.)(.)(.)(.)" {$F0="\0";$F1="\1";$F2="\2";$F3="\3";$F4="\4";$F5="\5";$F6="\6";$F7="\7";$F8="\8";$F9="\9"}' $indir/capture-lengths.dkvp run_mlr --opprint put '$FIELD =~ "(.)(.)(.)(.)(.)(.)(.)(.)(.)(.)" {$F0="\0";$F1="\1";$F2="\2";$F3="\3";$F4="\4";$F5="\5";$F6="\6";$F7="\7";$F8="\8";$F9="\9"}' $indir/capture-lengths.dkvp run_mlr --opprint put 'filter $FIELD =~ "(.)"; $F0="\0";$F1="\1";$F2="\2";$F3="\3";$F4="\4";$F5="\5";$F6="\6";$F7="\7";$F8="\8";$F9="\9"' $indir/capture-lengths.dkvp run_mlr --opprint put 'filter $FIELD =~ "(.)(.)"; $F0="\0";$F1="\1";$F2="\2";$F3="\3";$F4="\4";$F5="\5";$F6="\6";$F7="\7";$F8="\8";$F9="\9"' $indir/capture-lengths.dkvp run_mlr --opprint put 'filter $FIELD =~ "(.)(.)(.)"; $F0="\0";$F1="\1";$F2="\2";$F3="\3";$F4="\4";$F5="\5";$F6="\6";$F7="\7";$F8="\8";$F9="\9"' $indir/capture-lengths.dkvp run_mlr --opprint put 'filter $FIELD =~ "(.)(.)(.)(.)"; $F0="\0";$F1="\1";$F2="\2";$F3="\3";$F4="\4";$F5="\5";$F6="\6";$F7="\7";$F8="\8";$F9="\9"' $indir/capture-lengths.dkvp run_mlr --opprint put 'filter $FIELD =~ "(.)(.)(.)(.)(.)"; $F0="\0";$F1="\1";$F2="\2";$F3="\3";$F4="\4";$F5="\5";$F6="\6";$F7="\7";$F8="\8";$F9="\9"' $indir/capture-lengths.dkvp run_mlr --opprint put 'filter $FIELD =~ "(.)(.)(.)(.)(.)(.)"; $F0="\0";$F1="\1";$F2="\2";$F3="\3";$F4="\4";$F5="\5";$F6="\6";$F7="\7";$F8="\8";$F9="\9"' $indir/capture-lengths.dkvp run_mlr --opprint put 'filter $FIELD =~ "(.)(.)(.)(.)(.)(.)(.)"; $F0="\0";$F1="\1";$F2="\2";$F3="\3";$F4="\4";$F5="\5";$F6="\6";$F7="\7";$F8="\8";$F9="\9"' $indir/capture-lengths.dkvp run_mlr --opprint put 'filter $FIELD =~ "(.)(.)(.)(.)(.)(.)(.)(.)"; $F0="\0";$F1="\1";$F2="\2";$F3="\3";$F4="\4";$F5="\5";$F6="\6";$F7="\7";$F8="\8";$F9="\9"' $indir/capture-lengths.dkvp run_mlr --opprint put 'filter $FIELD =~ "(.)(.)(.)(.)(.)(.)(.)(.)(.)"; $F0="\0";$F1="\1";$F2="\2";$F3="\3";$F4="\4";$F5="\5";$F6="\6";$F7="\7";$F8="\8";$F9="\9"' $indir/capture-lengths.dkvp run_mlr --opprint put 'filter $FIELD =~ "(.)(.)(.)(.)(.)(.)(.)(.)(.)(.)"; $F0="\0";$F1="\1";$F2="\2";$F3="\3";$F4="\4";$F5="\5";$F6="\6";$F7="\7";$F8="\8";$F9="\9"' $indir/capture-lengths.dkvp # ---------------------------------------------------------------- announce DSL FILTER/PATTERN-ACTION run_mlr --opprint put ' $x > 0.5; $z = "flag"' $indir/abixy run_mlr --opprint put ' !($x > 0.5); $z = "flag"' $indir/abixy run_mlr --opprint put 'filter $x > 0.5; $z = "flag"' $indir/abixy run_mlr --opprint put ' $x > 0.5 {$z = "flag"}' $indir/abixy run_mlr --opprint put 'filter !($x > 0.5); $z = "flag"' $indir/abixy run_mlr --opprint put ' !($x > 0.5) {$z = "flag"}' $indir/abixy # ---------------------------------------------------------------- announce DSL DATETIME FUNCTIONS run_mlr --csvlite put '$gmt = sec2gmt($sec)' $indir/sec2gmt run_mlr --csvlite put '$sec = gmt2sec($gmt)' $indir/gmt2sec run_mlr --csvlite put '$gmtdate = sec2gmtdate($sec)' $indir/sec2gmt run_mlr --csvlite put '$gmt = strftime($sec, "%Y-%m-%dT%H:%M:%SZ")' $indir/sec2gmt run_mlr --csvlite put '$sec = strptime($gmt, "%Y-%m-%dT%H:%M:%SZ")' $indir/gmt2sec run_mlr --csvlite sec2gmt sec $indir/sec2gmt run_mlr --opprint put '$hms=sec2hms($sec); $resec=hms2sec($hms); $diff=$resec-$sec' $indir/sec2xhms run_mlr --opprint put '$hms=fsec2hms($sec); $resec=hms2fsec($hms); $diff=$resec-$sec' $indir/fsec2xhms run_mlr --opprint put '$hms=sec2dhms($sec); $resec=dhms2sec($hms); $diff=$resec-$sec' $indir/sec2xhms run_mlr --opprint put '$hms=fsec2dhms($sec); $resec=dhms2fsec($hms); $diff=$resec-$sec' $indir/fsec2xhms run_mlr --csvlite sec2gmt sec $indir/sec2gmt run_mlr --csvlite sec2gmtdate sec $indir/sec2gmt # ---------------------------------------------------------------- announce DSL SUB/GSUB run_mlr --opprint put '$y = sub($x, "e.*l", "")' $indir/sub.dat run_mlr --opprint put '$y = sub($x, "e.*l"i, "")' $indir/sub.dat run_mlr --opprint put '$y = sub($x, "e.*"."l", "")' $indir/sub.dat run_mlr --opprint put '$y = sub($x, "e.*l", "y123y")' $indir/sub.dat run_mlr --opprint put '$y = sub($x, "e.*l"i, "y123y")' $indir/sub.dat run_mlr --opprint put '$y = sub($x, "e.*"."l", "y123y")' $indir/sub.dat run_mlr --opprint put '$y = sub($x, "([hg])e.*l(.)", "y\1y123\2y")' $indir/sub.dat run_mlr --opprint put '$y = sub($x, "([hg])e.*l.", "y\1y123\2y")' $indir/sub.dat run_mlr --opprint put '$y = sub($x, "([hg])e.*l(.)", "y\1y123.y")' $indir/sub.dat run_mlr --opprint put '$y = sub($x, "a", "aa")' $indir/gsub.dat run_mlr --opprint put '$y = gsub($x, "a", "aa")' $indir/gsub.dat run_mlr --opprint put '$y = gsub($x, "A", "Aa")' $indir/gsub.dat run_mlr --opprint put '$y = gsub($x, "a"i, "Aa")' $indir/gsub.dat run_mlr --opprint put '$y = gsub($x, "A"i, "Aa")' $indir/gsub.dat run_mlr --opprint put '$y = gsub($x, "a(.)", "aa\1\1\1")' $indir/gsub.dat run_mlr --opprint put '$y = sub($x, "a", "")' $indir/gsub.dat run_mlr --opprint put '$y = gsub($x, "a", "")' $indir/gsub.dat run_mlr --opprint put '$y = gsub($x, "A", "")' $indir/gsub.dat run_mlr --opprint put '$y = gsub($x, "a"i, "")' $indir/gsub.dat run_mlr --opprint put '$y = gsub($x, "A"i, "")' $indir/gsub.dat run_mlr --oxtab cat $indir/subtab.dkvp run_mlr --oxtab put -f $indir/subtab1.mlr $indir/subtab.dkvp run_mlr --oxtab put -f $indir/subtab2.mlr $indir/subtab.dkvp run_mlr --oxtab put -f $indir/subtab3.mlr $indir/subtab.dkvp run_mlr --oxtab put -f $indir/subtab4.mlr $indir/subtab.dkvp # ---------------------------------------------------------------- announce DSL SUBSTR run_mlr put -q ' int n = strlen($x); print "input= <<".$x.">>"; for (i = -n-2; i <= n+2; i += 1) { for (j = -n-2; j <= n+2; j += 1) { print "i: ".fmtnum(i,"%3d") ." j:".fmtnum(j,"%3d") ." substr(".$x.",".fmtnum(i,"%3d").",".fmtnum(j,"%3d")."): <<" .substr($x, i, j) .">>"; } print; } ' << EOF x= x=o x=o1 x=o123456789 EOF # ---------------------------------------------------------------- announce DSL OOSVARS run_mlr --opprint put -v 'begin{@ox=0}; $d=$x-@ox; @ox=$x' $indir/abixy run_mlr --opprint put -v 'begin{@ox="no"}; $d=@ox == "no" ? 1.0 : $x/@ox; @ox=$x' then step -a ratio -f x $indir/abixy run_mlr --opprint put -v '$d=$x/@ox; @ox=$x' then step -a ratio -f x $indir/abixy run_mlr --opprint put -v 'begin{@ox="no"}; $d=@ox == "no" ? 1.0 : $x/@ox; @ox=$x' then step -a ratio -f x $indir/abixy run_mlr --opprint put -v 'begin{@rsum = 0}; @rsum = @rsum + $x; $rsum = @rsum' $indir/abixy run_mlr --opprint put -v 'begin{@a=0; @b=0; @c=0}; $za=@a; $zb=@b; $zc=@c; $d=@a+@b+@c; @a=@b; @b=@c; @c=$i' $indir/abixy run_mlr --opprint put -v 'begin {@a=0; @b=0; @c=0}; $za=@a; $zb=@b; $zc=@c; $d=@a+@b+@c; @a=@b; @b=@c; @c=$i' $indir/abixy run_mlr --opprint put -v 'begin{@ox=0}; $d=$x-@ox; @ox=$x' $indir/abixy run_mlr put -v '@a=$a; @b=$b; @c=$x; end {emitf @a; emitf @b; emitf @c}' $indir/abixy run_mlr put -v '@a=$a; @b=$b; @c=$x; end{emitf @a, @b, @c}' $indir/abixy run_mlr --opprint put -v 'begin {@count=0; @sum=0.0}; @count=@count+1; @sum=@sum+$x; end{@mean=@sum/@count; emitf @mean}' $indir/abixy run_mlr --opprint put -v 'end{@mean=@sum/@count; emitf @mean}; begin {@count=0; @sum=0.0}; @count=@count+1; @sum=@sum+$x' $indir/abixy run_mlr put -v 'begin{ @a = @b[1] }; $c = @d; @e[$i][2+$j][3] = $4; end{@f[@g[5][@h]] = 6}' /dev/null run_mlr put '@y[$a]=$y; end{dump}' $indir/abixy run_mlr stats1 -a sum -f y -g a $indir/abixy run_mlr put '@y_sum[$a] = $y; end{dump}' $indir/abixy run_mlr put -q '@s=$x; @t[$a]=$x; @u[$a][$b]=$x; end{dump; unset @s ; dump}' $indir/unset1.dkvp run_mlr put -q '@s=$x; @t[$a]=$x; @u[$a][$b]=$x; end{dump; unset @t ; dump}' $indir/unset1.dkvp run_mlr put -q '@s=$x; @t[$a]=$x; @u[$a][$b]=$x; end{dump; unset @t[1] ; dump}' $indir/unset1.dkvp run_mlr put -q '@s=$x; @t[$a]=$x; @u[$a][$b]=$x; end{dump; unset @u ; dump}' $indir/unset1.dkvp run_mlr put -q '@s=$x; @t[$a]=$x; @u[$a][$b]=$x; end{dump; unset @u[1] ; dump}' $indir/unset1.dkvp run_mlr put -q '@s=$x; @t[$a]=$x; @u[$a][$b]=$x; end{dump; unset @u[1][2]; dump}' $indir/unset1.dkvp run_mlr put -q '@s=$x; @t[$a]=$x; @u[$a][$b]=$x; end{dump; unset @s ; dump}' $indir/unset4.dkvp run_mlr put -q '@s=$x; @t[$a]=$x; @u[$a][$b]=$x; end{dump; unset @t ; dump}' $indir/unset4.dkvp run_mlr put -q '@s=$x; @t[$a]=$x; @u[$a][$b]=$x; end{dump; unset @t[1] ; dump}' $indir/unset4.dkvp run_mlr put -q '@s=$x; @t[$a]=$x; @u[$a][$b]=$x; end{dump; unset @u ; dump}' $indir/unset4.dkvp run_mlr put -q '@s=$x; @t[$a]=$x; @u[$a][$b]=$x; end{dump; unset @u[1] ; dump}' $indir/unset4.dkvp run_mlr put -q '@s=$x; @t[$a]=$x; @u[$a][$b]=$x; end{dump; unset @u[1][2]; dump}' $indir/unset4.dkvp run_mlr put -q '@s=$x; @t[$a]=$x; @u[$a][$b]=$x; end{dump; unset all; dump}' $indir/unset4.dkvp run_mlr put -q '@s=$x; @t[$a]=$x; @u[$a][$b]=$x; end{dump; unset @*; dump}' $indir/unset4.dkvp run_mlr put 'unset $x' $indir/unset4.dkvp run_mlr put 'unset $*; $aaa = 999' $indir/unset4.dkvp run_mlr --from $indir/abixy put 'x = 1; print "OX=".x; unset x; print "NX=".x' run_mlr put -q '@{variable.name} += $x; end{emit @{variable.name}}' $indir/abixy run_mlr put -q '@{variable.name}[$a] += $x; end{emit @{variable.name},"a"}' $indir/abixy run_mlr put 'for (k,v in $*) { if (k == "i") {unset $[k]}}' $indir/abixy run_mlr --opprint --from $indir/abixy put -q ' @output[NR] = $*; end { for ((nr, k), v in @output) { if (nr == 4 || k == "i") { unset @output[nr][k] } } emitp @output, "NR", "k" } ' # ---------------------------------------------------------------- announce DSL PATTERN-ACTION BLOCKS run_mlr put -v 'begin{@a=1}; $e=2; $f==$g||$h==$i {}; $x=6; end{@z=9}' /dev/null run_mlr put -v 'begin{@a=1}; $e=2; $f==$g||$h==$i {$s=1}; $x=6; end{@z=9}' /dev/null run_mlr put -v 'begin{@a=1}; $e=2; $f==$g||$h==$i {$s=1;$t=2}; $x=6; end{@z=9}' /dev/null run_mlr put -v 'begin{@a=1}; $e=2; $f==$g||$h==$i {$s=1;$t=2;$u=3}; $x=6; end{@z=9}' /dev/null run_mlr put -v 'begin{@a=1}; $e=2; $f==$g||$h==$i {$s=1;@t["u".$5]=2;emitf @v,@w;dump}; $x=6; end{@z=9}' /dev/null run_mlr put -v 'begin{true{@x=1}}; true{@x=2}; end{true{@x=3}}' /dev/null # ---------------------------------------------------------------- announce DSL STACK-ALLOCATION # This important test validates the local-stack allocator: which variables are # assigned which offsets in the stack, and how the local-extent contract is # satisfied by the clear-at-enter-subframe logic. The -v flag gives context on # the AST; the -a flag provides the essential output on variable placement; the # Miller script per se validates semantics. run_mlr --from $indir/abixy put -v -a -f $indir/test-dsl-stack-allocation.mlr # These test absent-null handing for as-yet-undefined localvars in expression RHSs. run_mlr --from $indir/abixy put 'a=a; $oa = a' run_mlr --from $indir/abixy put 'a=a; $oa = a; a = a; $ob = a' run_mlr --from $indir/abixy put 'a=a; $oa = a; a = a; $ob = a; a = b; $oc = a' run_mlr --from $indir/abixy put 'a=a; $oa = a; a = a; $ob = a; a = b; $oc = a; b = 3; b = a; $od = a' run_mlr --from $indir/abixy put 'a=a; $oa = a; a = a; $ob = a; a = b; $oc = a; b = 3; b = a; $od = a; b = 4;a = b; $oe= a' # ---------------------------------------------------------------- announce DSL IF-CHAINING mention IF/ELIF WITH ELSE run_mlr --from $indir/xy40.dkvp put -v ' if (NR==1) { $x = 2; $y = 3 }' run_mlr --from $indir/xy40.dkvp put -v ' if (NR == 4) { $x = 5; $y = 6 } else { $x = 1007; $y = 1008 }' run_mlr --from $indir/xy40.dkvp put -v ' if (NR == 9) { $x = 10; $y = 11 } elif (NR == 12) { $x = 13; $y = 14 } else { $x = 1015; $y = 1016 }' run_mlr --from $indir/xy40.dkvp put -v ' if (NR == 17) { $x = 18; $y = 19 } elif (NR == 20) { $x = 21; $y = 22 } elif (NR == 23) { $x = 24; $y = 25 } else { $x = 1026; $y = 1027 }' run_mlr --from $indir/xy40.dkvp put -v ' if (NR == 28) { $x = 29; $y = 30 } elif (NR == 31) { $x = 32; $y = 33 } elif (NR == 34) { $x = 35; $y = 36 } elif (NR == 37) { $x = 38; $y = 39 } else { $x = 1040; $y = 1041 }' mention IF/ELIF WITHOUT ELSE run_mlr --from $indir/xy40.dkvp put -v ' if (NR == 1) { $x = 2; $y = 3 }' run_mlr --from $indir/xy40.dkvp put -v ' if (NR == 4) { $x = 5; $y = 6 } elif (NR == 7) { $x = 8; $y = 9 }' run_mlr --from $indir/xy40.dkvp put -v ' if (NR == 10) { $x = 11; $y = 12 } elif (NR == 13) { $x = 14; $y = 15 } elif (NR == 16) { $x = 17; $y = 18 }' run_mlr --from $indir/xy40.dkvp put -v ' if (NR == 19) { $x = 20; $y = 21 } elif (NR == 22) { $x = 23; $y = 24 } elif (NR == 25) { $x = 26; $y = 37 } elif (NR == 28) { $x = 29; $y = 30 }' # ---------------------------------------------------------------- announce DSL INDIRECT SREC ASSIGNMENTS run_mlr put -v '$["a"] = $["b"]; $["x"] = 10 * $["y"]' $indir/abixy run_mlr --from $indir/abixy put 'while (NF < 256) { $["k".string(NF+1)] = "v".string(NF) }' # ---------------------------------------------------------------- announce DSL INDIRECT OOSVAR ASSIGNMENTS run_mlr --opprint put -v '@s = NR; $t = @s; $u=@["s"]; $v = $t - $u' $indir/abixy run_mlr put -v '@t["u"] = NR; $tu = @["t"]["u"]; emitp all' $indir/abixy run_mlr put -v '@t["u"] = NR; $tu = @["t"]["u"]; emitp @*' $indir/abixy run_mlr put -v '@["s"] = $x; emitp all' $indir/abixy run_mlr put -v '@["t"]["u"] = $y; emitp all' $indir/abixy # xxx @* on the right # xxx @* on the left # ---------------------------------------------------------------- announce DSL WHILE/DO-WHILE LOOPS run_mlr put -v 'while($i < 5) { $i += 1}' $indir/abixy run_mlr put -v 'do {$i += 1} while($i < 5)' $indir/abixy # ---------------------------------------------------------------- announce DSL FOR-SREC LOOPS mention empty for-srec run_mlr --from $indir/abixy put -v 'for(k,v in $*) { }' mention for-srec without boundvars run_mlr --from $indir/abixy put -v 'for(k,v in $*) {$nr= NR}' mention for-srec modifying the srec run_mlr --from $indir/abixy put -v 'for(k,v in $*) {unset $[k]}; $j = NR' run_mlr --from $indir/abixy put -v 'for(k,v in $*) {if (k != "x") {unset $[k]}}; $j = NR' run_mlr --from $indir/abixy --opprint put -S -v 'for(k,v in $*) {$[k."_orig"]=v; $[k] = "other"}' run_mlr --from $indir/abixy put -S -v 'for(k,v in $*) {$[v]=k}' run_mlr --from $indir/abixy put -v ' $sum = 0; for(k,v in $*) { if (k =~ "^[xy]$") { $sum += $[k] } }' run_mlr --from $indir/abixy put -S -v ' $sum = float(0); for(k,v in $*) { if (k =~ "^[xy]$") { $sum += float($[k]) } }' # ---------------------------------------------------------------- announce DSL FOR-OOSVAR LOOPS run_mlr --opprint -n put -v ' @o[1][1]["text1"][NR] = $a; @o[1][2]["text2"][NR] = $b; @o[1][2][$a][$i*100] = $x; for((k1,k2),v in @o[1][2]) { @n[3][4][k2][k1] = v; } end { emit @n, "a", "b", "c", "d" } ' run_mlr --opprint --from $indir/abixy put -q ' @o[1][1]["text1"][NR] = $a; @o[1][2]["text2"][NR] = $b; @o[1][2][$a][$i*100] = $x; for((k1,k2),v in @o[1][2]) { @n[3][4][k2][k1] = v; } end { emit @n, "a", "b", "c", "d" } ' run_mlr --opprint --from $indir/abixy put -q ' @sum[$a][$b] += $x; @count[$a][$b] += 1; end { for ((k1, k2), v in @sum) { @mean[k1][k2] = @sum[k1][k2] / @count[k1][k2] } emitp @sum, "a", "b"; emitp @count, "a", "b"; emitp @mean, "a", "b" } ' run_mlr --opprint --from $indir/abixy-wide put -q ' @value["sum"][$a][$b] += $x; @value["count"][$a][$b] += 1; end { for ((k1, k2), v in @value["sum"]) { @value["mean"][k1][k2] = @value["sum"][k1][k2] / @value["count"][k1][k2] } emitp @value, "stat", "a", "b"; } ' mlr_expect_fail -n put -v 'for (k, k in $*) {}' mlr_expect_fail -n put -v 'for (k, k in @*) {}' mlr_expect_fail -n put -v 'for ((a,a), c in @*) {}' mlr_expect_fail -n put -v 'for ((a,b), a in @*) {}' mlr_expect_fail -n put -v 'for ((a,b), b in @*) {}' mlr_expect_fail -n put -v 'for ((a,a,c), d in @*) {}' mlr_expect_fail -n put -v 'for ((a,b,a), d in @*) {}' mlr_expect_fail -n put -v 'for ((a,b,c), a in @*) {}' mlr_expect_fail -n put -v 'for ((a,b,b), d in @*) {}' mlr_expect_fail -n put -v 'for ((a,b,c), b in @*) {}' mlr_expect_fail -n put -v 'for ((a,b,c), c in @*) {}' # ---------------------------------------------------------------- announce DSL BREAK/CONTINUE IN SINGLE WHILE/DO-WHILE run_mlr --opprint --from $indir/abixy put ' while ($i < 5) { $i += 1; break; $a = "ERROR"; } ' run_mlr --opprint --from $indir/abixy put ' while ($i < 5) { $i += 1; continue; $a = "ERROR"; } ' run_mlr --opprint --from $indir/abixy put ' do { $i += 1; break; $a = "ERROR"; } while ($i < 5); ' run_mlr --opprint --from $indir/abixy put ' do { $i += 1; continue; $a = "ERROR"; } while ($i < 5); ' run_mlr --opprint --from $indir/abixy put ' $NR = NR; while ($i < 5) { $i += 1; if (NR == 2) { break; } $a = "reached"; } ' run_mlr --opprint --from $indir/abixy put ' $NR = NR; while ($i < 5) { $i += 1; if (NR == 2) { continue; } $a = "reached"; } ' run_mlr --opprint --from $indir/abixy put ' $NR = NR; do { $i += 1; if (NR == 2) { break; } $a = "reached"; } while ($i < 5); ' run_mlr --opprint --from $indir/abixy put ' $NR = NR; do { $i += 1; if (NR == 2) { continue; } $a = "reached"; } while ($i < 5); ' # ---------------------------------------------------------------- announce DSL BREAK/CONTINUE IN NESTED WHILE/DO-WHILE run_mlr --opprint --from $indir/abixy put ' $j = NR; while ($j < 4) { $k = NR; $j += 1; break; while ($k < 7) { $k += 1 } } ' run_mlr --opprint --from $indir/abixy put ' $j = NR; while ($j < 4) { $k = NR; $j += 1; continue; while ($k < 7) { $k += 1 } } ' run_mlr --opprint --from $indir/abixy put ' $j = NR; while ($j < 4) { $k = NR; $j += 1; while ($k < 7) { $k += 1; break; $k += 10000; } } ' run_mlr --opprint --from $indir/abixy put ' $j = NR; while ($j < 4) { $k = NR; $j += 1; while ($k < 7) { $k += 1; continue; $k += 10000; } } ' run_mlr --opprint --from $indir/abixy put ' $j = NR; while ($j < 4) { $k = NR; $j += 1; if (NR == 2 || NR == 8) { break; } while ($k < 7) { $k += 1 } } ' run_mlr --opprint --from $indir/abixy put ' $j = NR; while ($j < 4) { $k = NR; $j += 1; if (NR == 2 || NR == 8) { continue; } while ($k < 7) { $k += 1 } } ' run_mlr --opprint --from $indir/abixy put ' $j = NR; while ($j < 4) { $k = NR; $j += 1; while ($k < 7) { $k += 1; if (NR == 2 || NR == 8) { break; } $k += 10000; } } ' run_mlr --opprint --from $indir/abixy put ' $j = NR; while ($j < 4) { $k = NR; $j += 1; while ($k < 7) { $k += 1; if (NR == 2 || NR == 8) { continue; } $k += 10000; } } ' run_mlr --opprint --from $indir/abixy put ' $j = NR; do { $k = NR; $j += 1; break; do { $k += 1 } while ($k < 7); } while ($j < 4); ' run_mlr --opprint --from $indir/abixy put ' $j = NR; do { $k = NR; $j += 1; continue; do { $k += 1 } while ($k < 7); } while ($j < 4); ' run_mlr --opprint --from $indir/abixy put ' $j = NR; do { $k = NR; $j += 1; do { $k += 1; break; $k += 10000; } while ($k < 7); } while ($j < 4); ' run_mlr --opprint --from $indir/abixy put ' $j = NR; do { $k = NR; $j += 1; do { $k += 1; continue; $k += 10000; } while ($k < 7); } while ($j < 4); ' run_mlr --opprint --from $indir/abixy put ' $j = NR; do { $k = NR; $j += 1; if (NR == 2 || NR == 8) { break; } do { $k += 1 } while ($k < 7); } while ($j < 4); ' run_mlr --opprint --from $indir/abixy put ' $j = NR; do { $k = NR; $j += 1; if (NR == 2 || NR == 8) { continue; } do { $k += 1 } while ($k < 7); } while ($j < 4); ' run_mlr --opprint --from $indir/abixy put ' $j = NR; do { $k = NR; $j += 1; do { $k += 1; if (NR == 2 || NR == 8) { break; } $k += 10000; } while ($k < 7); } while ($j < 4); ' run_mlr --opprint --from $indir/abixy put ' $j = NR; do { $k = NR; $j += 1; do { $k += 1; if (NR == 2 || NR == 8) { continue; } $k += 10000; } while ($k < 7); } while ($j < 4); ' # ---------------------------------------------------------------- announce DSL BREAK/CONTINUE IN SINGLE FOR-SREC run_mlr --opprint --from $indir/abixy put -q ' for (k,v in $*) { @logging1[NR][k] = v; if (k == "x") { break; } } end { emitp @logging1, "NR", "k"; } ' run_mlr --opprint --from $indir/abixy put -q ' for (k,v in $*) { if (k == "x") { break; } @logging2[NR][k] = v; } end { emitp @logging2, "NR", "k"; } ' run_mlr --opprint --from $indir/abixy put -q ' for (k,v in $*) { @logging3[NR][k] = v; if (k == "x") { continue; } } end { emitp @logging3, "NR", "k"; } ' run_mlr --opprint --from $indir/abixy put -q ' for (k,v in $*) { if (k == "x") { continue; } @logging4[NR][k] = v; } end { emitp @logging4, "NR", "k" } ' run_mlr --opprint --from $indir/abixy put -q ' for (k,v in $*) { @logging1[NR][k] = v; if (k == "x") { break; } } for (k,v in $*) { if (k == "x") { break; } @logging2[NR][k] = v; } for (k,v in $*) { @logging3[NR][k] = v; if (k == "x") { continue; } } for (k,v in $*) { if (k == "x") { continue; } @logging4[NR][k] = v; } end { emitp @logging1, "NR", "k"; emitp @logging2, "NR", "k"; emitp @logging3, "NR", "k"; emitp @logging4, "NR", "k" } ' # ---------------------------------------------------------------- announce DSL BREAK/CONTINUE IN NESTED FOR-SREC run_mlr --opprint --from $indir/abixy put -q ' for (k1, v1 in $*) { @output1[NR][k1] = "before"; break; @output1[NR][k1] = v1; for (k2, v2 in $*) { @output2[NR][k1."_".k2] = "before"; @output2[NR][k1."_".k2] = v2; } } end { emit @output1, "NR", "name"; emit @output2, "NR", "names"; } ' run_mlr --opprint --from $indir/abixy put -q ' for (k1, v1 in $*) { @output1[NR][k1] = "before"; continue; @output1[NR][k1] = v1; for (k2, v2 in $*) { @output2[NR][k1."_".k2] = "before"; @output2[NR][k1."_".k2] = v2; } } end { emit @output1, "NR", "name"; emit @output2, "NR", "names"; } ' run_mlr --opprint --from $indir/abixy put -q ' for (k1, v1 in $*) { @output1[NR][k1] = "before"; @output1[NR][k1] = v1; for (k2, v2 in $*) { @output2[NR][k1."_".k2] = "before"; break; @output2[NR][k1."_".k2] = v2; } } end { emit @output1, "NR", "name"; emit @output2, "NR", "names"; } ' run_mlr --opprint --from $indir/abixy put -q ' for (k1, v1 in $*) { @output1[NR][k1] = "before"; @output1[NR][k1] = v1; for (k2, v2 in $*) { @output2[NR][k1."_".k2] = "before"; continue; @output2[NR][k1."_".k2] = v2; } } end { emit @output1, "NR", "name"; emit @output2, "NR", "names"; } ' run_mlr --opprint --from $indir/abixy put -q ' for (k1, v1 in $*) { @output1[NR][k1] = "before"; break; @output1[NR][k1] = v1; for (k2, v2 in $*) { @output2[NR][k1."_".k2] = "before"; break; @output2[NR][k1."_".k2] = v2; } } end { emit @output1, "NR", "name"; emit @output2, "NR", "names"; } ' run_mlr --opprint --from $indir/abixy put -q ' for (k1, v1 in $*) { @output1[NR][k1] = "before"; continue; @output1[NR][k1] = v1; for (k2, v2 in $*) { @output2[NR][k1."_".k2] = "before"; break; @output2[NR][k1."_".k2] = v2; } } end { emit @output1, "NR", "name"; emit @output2, "NR", "names"; } ' run_mlr --opprint --from $indir/abixy put -q ' for (k1, v1 in $*) { @output1[NR][k1] = "before"; break; @output1[NR][k1] = v1; for (k2, v2 in $*) { @output2[NR][k1."_".k2] = "before"; continue; @output2[NR][k1."_".k2] = v2; } } end { emit @output1, "NR", "name"; emit @output2, "NR", "names"; } ' run_mlr --opprint --from $indir/abixy put -q ' for (k1, v1 in $*) { @output1[NR][k1] = "before"; continue; @output1[NR][k1] = v1; for (k2, v2 in $*) { @output2[NR][k1."_".k2] = "before"; continue; @output2[NR][k1."_".k2] = v2; } } end { emit @output1, "NR", "name"; emit @output2, "NR", "names"; } ' run_mlr --opprint --from $indir/abixy put -q ' for (k1, v1 in $*) { @output1[NR][k1] = "before"; if (k1 == "b") { break } @output1[NR][k1] = v1; for (k2, v2 in $*) { @output2[NR][k1."_".k2] = "before"; @output2[NR][k1."_".k2] = v2; } } end { emit @output1, "NR", "name"; emit @output2, "NR", "names"; } ' run_mlr --opprint --from $indir/abixy put -q ' for (k1, v1 in $*) { @output1[NR][k1] = "before"; if (k1 == "b") { continue } @output1[NR][k1] = v1; for (k2, v2 in $*) { @output2[NR][k1."_".k2] = "before"; @output2[NR][k1."_".k2] = v2; } } end { emit @output1, "NR", "name"; emit @output2, "NR", "names"; } ' run_mlr --opprint --from $indir/abixy put -q ' for (k1, v1 in $*) { @output1[NR][k1] = "before"; @output1[NR][k1] = v1; for (k2, v2 in $*) { @output2[NR][k1."_".k2] = "before"; if (k2 == "a") { break } @output2[NR][k1."_".k2] = v2; } } end { emit @output1, "NR", "name"; emit @output2, "NR", "names"; } ' run_mlr --opprint --from $indir/abixy put -q ' for (k1, v1 in $*) { @output1[NR][k1] = "before"; @output1[NR][k1] = v1; for (k2, v2 in $*) { @output2[NR][k1."_".k2] = "before"; if (k2 == "b") { continue } @output2[NR][k1."_".k2] = v2; } } end { emit @output1, "NR", "name"; emit @output2, "NR", "names"; } ' run_mlr --opprint --from $indir/abixy put -q ' for (k1, v1 in $*) { @output1[NR][k1] = "before"; if (k1 == "b") { break } @output1[NR][k1] = v1; for (k2, v2 in $*) { @output2[NR][k1."_".k2] = "before"; if (k2 == "a") { break } @output2[NR][k1."_".k2] = v2; } } end { emit @output1, "NR", "name"; emit @output2, "NR", "names"; } ' run_mlr --opprint --from $indir/abixy put -q ' for (k1, v1 in $*) { @output1[NR][k1] = "before"; if (k1 == "b") { continue } @output1[NR][k1] = v1; for (k2, v2 in $*) { @output2[NR][k1."_".k2] = "before"; if (k2 == "a") { break } @output2[NR][k1."_".k2] = v2; } } end { emit @output1, "NR", "name"; emit @output2, "NR", "names"; } ' run_mlr --opprint --from $indir/abixy put -q ' for (k1, v1 in $*) { @output1[NR][k1] = "before"; if (k1 == "b") { break } @output1[NR][k1] = v1; for (k2, v2 in $*) { @output2[NR][k1."_".k2] = "before"; if (k2 == "a") { continue } @output2[NR][k1."_".k2] = v2; } } end { emit @output1, "NR", "name"; emit @output2, "NR", "names"; } ' run_mlr --opprint --from $indir/abixy put -q ' for (k1, v1 in $*) { @output1[NR][k1] = "before"; if (k1 == "b") { continue } @output1[NR][k1] = v1; for (k2, v2 in $*) { @output2[NR][k1."_".k2] = "before"; if (k2 == "a") { continue } @output2[NR][k1."_".k2] = v2; } } end { emit @output1, "NR", "name"; emit @output2, "NR", "names"; } ' # ---------------------------------------------------------------- announce FOR-OOSVAR DEPTH TESTS mention 'for full oosvar' run_mlr --from $indir/abixy put '@o[1][2] = 7; for(k1,v in @*) {$x+=10;$y+=100}' run_mlr --from $indir/abixy put '@o[1][2] = 7; for((k1),v in @*) {$x+=10;$y+=100}' run_mlr --from $indir/abixy put '@o[1][2] = 7; for((k1,k2),v in @*) {$x+=10;$y+=100}' run_mlr --from $indir/abixy put '@o[1][2] = 7; for((k1,k2,k3),v in @*) {$x+=10;$y+=100}' mention 'for oosvar submap' run_mlr --from $indir/abixy put '@o[1][2][3] = 7; for(k1,v in @o[1][2]) {$x+=10;$y+=100}' run_mlr --from $indir/abixy put '@o[1][2][3] = 7; for((k1),v in @o[1][2]) {$x+=10;$y+=100}' run_mlr --from $indir/abixy put '@o[1][2][3] = 7; for((k1,k2),v in @o[1][2]) {$x+=10;$y+=100}' run_mlr --from $indir/abixy put '@o[1][2][3] = 7; for((k1,k2,k3),v in @o[1][2]) {$x+=10;$y+=100}' # ---------------------------------------------------------------- announce DSL BREAK/CONTINUE IN SINGLE FOR-OOSVAR mention single-key tests, direct break/continue run_mlr --opprint --from $indir/abixy put -q ' @logging[NR] = $*; end { for (k1, v in @logging[2]) { break; @output[k1] = v; } emit @output, "NR", "name" } ' run_mlr --opprint --from $indir/abixy put -q ' @logging[NR] = $*; end { for (k1, v in @logging[2]) { @output[k1] = v; break; @output[k1] = "ERROR"; } emit @output, "NR", "name" } ' run_mlr --opprint --from $indir/abixy put -q ' @logging[NR] = $*; end { for (k1, v in @logging[2]) { continue; @output[k1] = v } emit @output, "NR", "name" } ' run_mlr --opprint --from $indir/abixy put -q ' @logging[NR] = $*; end { for (k1, v in @logging[2]) { @output[k1] = v; continue; @output[k1] = "ERROR"; } emit @output, "NR", "name" } ' mention single-key tests, indirect break/continue run_mlr --opprint --from $indir/abixy put -q ' @logging[NR] = $*; end { for (k1, v in @logging[2]) { if (k1 == "i") { break; } @output[k1] = v; } emit @output, "NR", "name" } ' run_mlr --opprint --from $indir/abixy put -q ' @logging[NR] = $*; end { for (k1, v in @logging[2]) { @output[k1] = v; if (k1 == "i") { break; } } emit @output, "NR", "name" } ' run_mlr --opprint --from $indir/abixy put -q ' @logging[NR] = $*; end { for (k1, v in @logging[2]) { if (k1 == "i") { continue; } @output[k1] = v } emit @output, "NR", "name" } ' run_mlr --opprint --from $indir/abixy put -q ' @logging[NR] = $*; end { for (k1, v in @logging[2]) { @output[k1] = v; if (k1 == "i") { continue; } @output[k1] = "reached"; } emit @output, "NR", "name" } ' mention multiple-key tests, direct break/continue run_mlr --opprint --from $indir/abixy put -q ' @logging[NR] = $*; end { for ((k1, k2), v in @logging) { break; @output[k1][k2] = v; } emit @output, "NR", "name" } ' run_mlr --opprint --from $indir/abixy put -q ' @logging[NR] = $*; end { for ((k1, k2), v in @logging) { @output[k1][k2] = v; break; @output[k1][k2] = "ERROR" } emit @output, "NR", "name" } ' run_mlr --opprint --from $indir/abixy put -q ' @logging[NR] = $*; end { for ((k1, k2), v in @logging) { continue; @output[k1][k2] = v } emit @output, "NR", "name" } ' run_mlr --opprint --from $indir/abixy put -q ' @logging[NR] = $*; end { for ((k1, k2), v in @logging) { @output[k1][k2] = v; continue; @output[k1][k2] = "ERROR"; } emit @output, "NR", "name" } ' mention multiple-key tests, indirect break/continue run_mlr --opprint --from $indir/abixy put -q ' @logging[NR] = $*; end { for ((k1, k2), v in @logging) { if (k1 == 5) { break; } @output[k1][k2] = v; } emit @output, "NR", "name" } ' run_mlr --opprint --from $indir/abixy put -q ' @logging[NR] = $*; end { for ((k1, k2), v in @logging) { if (k2 == "i") { break; } @output[k1][k2] = v; } emit @output, "NR", "name" } ' run_mlr --opprint --from $indir/abixy put -q ' @logging[NR] = $*; end { for ((k1, k2), v in @logging) { @output[k1][k2] = v; if (k1 == 5) { break; } } emit @output, "NR", "name" } ' run_mlr --opprint --from $indir/abixy put -q ' @logging[NR] = $*; end { for ((k1, k2), v in @logging) { @output[k1][k2] = v; if (k2 == "i") { break; } } emit @output, "NR", "name" } ' run_mlr --opprint --from $indir/abixy put -q ' @logging[NR] = $*; end { for ((k1, k2), v in @logging) { if (k1 == 5) { continue; } @output[k1][k2] = v } emit @output, "NR", "name" } ' run_mlr --opprint --from $indir/abixy put -q ' @logging[NR] = $*; end { for ((k1, k2), v in @logging) { if (k2 == "i") { continue; } @output[k1][k2] = v } emit @output, "NR", "name" } ' run_mlr --opprint --from $indir/abixy put -q ' @logging[NR] = $*; end { for ((k1, k2), v in @logging) { @output[k1][k2] = "before"; if (k1 == 5) { continue; } @output[k1][k2] = v; } emit @output, "NR", "name" } ' run_mlr --opprint --from $indir/abixy put -q ' @logging[NR] = $*; end { for ((k1, k2), v in @logging) { @output[k1][k2] = "before"; if (k2 == "i") { continue; } @output[k1][k2] = v; } emit @output, "NR", "name" } ' # ---------------------------------------------------------------- announce DSL BREAK/CONTINUE IN NESTED FOR-OOSVAR run_mlr --opprint --from $indir/abixy put -q ' @logging[NR] = $*; end { for ((k1, k2), v in @logging) { if (k1 != 2) { continue } for ((k3, k4), v in @logging) { if (k3 != 4) { continue } @output[k1][k2][k3][k4] = v; } } emit @output, "NR1", "name1", "NR2", "name2" } ' # ---------------------------------------------------------------- announce DSL PRINT run_mlr put -q 'print 1; print "two"; print $a; print; print $i < 4; print "y is ".string($y); print ""' $indir/abixy run_mlr put -q 'printn 1; printn "two"; printn $a; printn; printn $i < 4; printn "y is ".string($y); print ""' $indir/abixy # ---------------------------------------------------------------- announce ABSENT/EMPTY run_mlr put -q '@sum += $x; end{emitp @sum}' $indir/abixy run_mlr put -q '@sum[$a] += $x; end{emitp @sum, "a"}' $indir/abixy run_mlr put '$nonesuch = @nonesuch' $indir/abixy run_mlr put -q '@sum += $x; end{emitp @sum}' $indir/abixy-het run_mlr put -q '@sum[$a] += $x; end{emitp @sum, "a"}' $indir/abixy-het run_mlr put '$nonesuch = @nonesuch' $indir/abixy-het run_mlr put -q '@sum += $x; @sumtype = typeof(@sum); @xtype = typeof($x); emitf @sumtype, @xtype, @sum; end{emitp @sum}' $indir/abixy run_mlr put -q '@sum += $x; @sumtype = typeof(@sum); @xtype = typeof($x); emitf @sumtype, @xtype, @sum; end{emitp @sum}' $indir/abixy-het run_mlr put '$z = $x + $y' $indir/typeof.dkvp run_mlr put '$z = $x + $u' $indir/typeof.dkvp run_mlr put '@s = @s + $y; emitp @s' $indir/typeof.dkvp run_mlr put '@s = @s + $u; emitp @s' $indir/typeof.dkvp run_mlr put '$z = $x + $y; $x=typeof($x);$y=typeof($y);$z=typeof($z)' $indir/typeof.dkvp run_mlr put '$z = $x + $u; $x=typeof($x);$y=typeof($y);$z=typeof($z)' $indir/typeof.dkvp run_mlr put '@s = @s + $y; $x=typeof($x);$y=typeof($y);$z=typeof($z);$s=typeof(@s)' $indir/typeof.dkvp run_mlr put '@s = @s + $u; $x=typeof($x);$y=typeof($y);$z=typeof($z);$s=typeof(@s)' $indir/typeof.dkvp run_mlr cat << EOF x=1 x= x=7 EOF run_mlr --ofs tab put '$osum=@sum; $ostype=typeof(@sum);$xtype=typeof($x);@sum+=$x; $nstype=typeof(@sum);$nsum=@sum; end { emit @sum }' < "'$tee2'/out.".$a, $*' $indir/abixy run_cat $tee2/out.eks run_cat $tee2/out.hat run_cat $tee2/out.pan run_cat $tee2/out.wye run_cat $tee2/out.zee run_mlr put -q --no-fflush 'tee > "'$tee2'/out.".$a, $*' $indir/abixy run_cat $tee2/out.eks run_cat $tee2/out.hat run_cat $tee2/out.pan run_cat $tee2/out.wye run_cat $tee2/out.zee run_mlr put -q 'tee >> "'$tee2'/out.".$a, $*' $indir/abixy run_cat $tee2/out.eks run_cat $tee2/out.hat run_cat $tee2/out.pan run_cat $tee2/out.wye run_cat $tee2/out.zee run_mlr put -q -o json 'tee > "'$tee2'/out.".$a, $*' $indir/abixy run_cat $tee2/out.eks run_cat $tee2/out.hat run_cat $tee2/out.pan run_cat $tee2/out.wye run_cat $tee2/out.zee run_mlr put -q 'tee | "tr \[a-z\] \[A-Z\]", $*' $indir/abixy run_mlr put -q -o json 'tee | "tr \[a-z\] \[A-Z\]", $*' $indir/abixy touch $tee2/err1 run_mlr put -q 'tee > stdout, $*' $indir/abixy 2> $tee2/err1 run_cat $tee2/err1 touch $tee2/err2 run_mlr put -q 'tee > stderr, $*' $indir/abixy 2> $tee2/err2 run_cat $tee2/err2 # ---------------------------------------------------------------- announce DSL PRINT REDIRECTS print1=$reloutdir/print1 mkdir -p $print1 run_mlr put -q 'print > "'$print1'/out.".$a, "abi:".$a.$b.$i' $indir/abixy run_cat $print1/out.eks run_cat $print1/out.hat run_cat $print1/out.pan run_cat $print1/out.wye run_cat $print1/out.zee run_mlr put -q 'print > "'$print1'/out.".$a, "abi:".$a.$b.$i' $indir/abixy run_cat $print1/out.eks run_cat $print1/out.hat run_cat $print1/out.pan run_cat $print1/out.wye run_cat $print1/out.zee run_mlr put -q 'print >> "'$print1'/out.".$a, "abi:".$a.$b.$i' $indir/abixy run_cat $print1/out.eks run_cat $print1/out.hat run_cat $print1/out.pan run_cat $print1/out.wye run_cat $print1/out.zee run_mlr put -q 'print | "tr \[a-z\] \[A-Z\]", "abi:".$a.$b.$i' $indir/abixy touch $print1/err1 run_mlr put -q 'print > stdout, "abi:".$a.$b.$i' $indir/abixy 2> $print1/err1 run_cat $print1/err1 touch $print1/err2 run_mlr put -q 'print > stderr, "abi:".$a.$b.$i' $indir/abixy 2> $print1/err2 run_cat $print1/err2 # ---------------------------------------------------------------- announce DSL PRINTN REDIRECTS printn1=$reloutdir/printn1 mkdir -p $printn1 run_mlr put -q 'printn > "'$printn1'/out.".$a, "abi:".$a.$b.$i' $indir/abixy run_cat $printn1/out.eks run_cat $printn1/out.hat run_cat $printn1/out.pan run_cat $printn1/out.wye run_cat $printn1/out.zee run_mlr put -q 'printn > "'$printn1'/out.".$a, "abi:".$a.$b.$i' $indir/abixy run_cat $printn1/out.eks run_cat $printn1/out.hat run_cat $printn1/out.pan run_cat $printn1/out.wye run_cat $printn1/out.zee run_mlr put -q 'printn >> "'$printn1'/out.".$a, "abi:".$a.$b.$i' $indir/abixy run_cat $printn1/out.eks run_cat $printn1/out.hat run_cat $printn1/out.pan run_cat $printn1/out.wye run_cat $printn1/out.zee run_mlr put -q 'printn | "tr \[a-z\] \[A-Z\]", "abi:".$a.$b.$i' $indir/abixy touch $printn1/err1 run_mlr put -q 'printn > stdout, "abi:".$a.$b.$i' $indir/abixy 2> $printn1/err1 run_cat $printn1/err1 touch $printn1/err2 run_mlr put -q 'printn > stderr, "abi:".$a.$b.$i' $indir/abixy 2> $printn1/err2 run_cat $printn1/err2 # ---------------------------------------------------------------- announce DSL DUMP REDIRECTS dump1=$reloutdir/dump1 mkdir -p $dump1 run_mlr put -q '@v=$*; dump > "'$dump1'/out.".$a' $indir/abixy run_cat $dump1/out.eks run_cat $dump1/out.hat run_cat $dump1/out.pan run_cat $dump1/out.wye run_cat $dump1/out.zee run_mlr put -q '@v=$*; dump > "'$dump1'/out.".$a' $indir/abixy run_cat $dump1/out.eks run_cat $dump1/out.hat run_cat $dump1/out.pan run_cat $dump1/out.wye run_cat $dump1/out.zee run_mlr put -q '@v=$*; dump >> "'$dump1'/out.".$a' $indir/abixy run_cat $dump1/out.eks run_cat $dump1/out.hat run_cat $dump1/out.pan run_cat $dump1/out.wye run_cat $dump1/out.zee run_mlr put -q '@v=$*; dump | "tr \[a-z\] \[A-Z\]"' $indir/abixy touch $dump1/err1 run_mlr put -q '@v[NR] = $*; NR == 2 { dump > stdout }' $indir/abixy 2> $dump1/err1 run_cat $dump1/err1 touch $dump1/err2 run_mlr put -q '@v[NR] = $*; NR == 2 { dump > stderr }' $indir/abixy 2> $dump1/err2 run_cat $dump1/err2 # ---------------------------------------------------------------- announce DSL EMITF REDIRECTS emitf1=$reloutdir/emitf1 mkdir -p $emitf1 run_mlr put -q '@a=$a; @b=$b; emitf > "'$emitf1'/out.".$a.$b, @a, @b' $indir/abixy run_cat $emitf1/out.ekspan run_cat $emitf1/out.ekswye run_cat $emitf1/out.ekszee run_cat $emitf1/out.hatwye run_cat $emitf1/out.panpan run_cat $emitf1/out.panwye run_cat $emitf1/out.wyepan run_cat $emitf1/out.wyewye run_cat $emitf1/out.zeepan run_cat $emitf1/out.zeewye run_mlr put -q '@a=$a; @b=$b; emitf > "'$emitf1'/out.".$a.$b, @a, @b' $indir/abixy run_cat $emitf1/out.ekspan run_cat $emitf1/out.ekswye run_cat $emitf1/out.ekszee run_cat $emitf1/out.hatwye run_cat $emitf1/out.panpan run_cat $emitf1/out.panwye run_cat $emitf1/out.wyepan run_cat $emitf1/out.wyewye run_cat $emitf1/out.zeepan run_cat $emitf1/out.zeewye run_mlr put -q '@a=$a; @b=$b; emitf >> "'$emitf1'/out.".$a.$b, @a, @b' $indir/abixy run_cat $emitf1/out.ekspan run_cat $emitf1/out.ekswye run_cat $emitf1/out.ekszee run_cat $emitf1/out.hatwye run_cat $emitf1/out.panpan run_cat $emitf1/out.panwye run_cat $emitf1/out.wyepan run_cat $emitf1/out.wyewye run_cat $emitf1/out.zeepan run_cat $emitf1/out.zeewye run_mlr put -q -o json '@a=$a; @b=$b; emitf > "'$emitf1'/out.".$a.$b, @a, @b' $indir/abixy run_cat $emitf1/out.ekspan run_cat $emitf1/out.ekswye run_cat $emitf1/out.ekszee run_cat $emitf1/out.hatwye run_cat $emitf1/out.panpan run_cat $emitf1/out.panwye run_cat $emitf1/out.wyepan run_cat $emitf1/out.wyewye run_cat $emitf1/out.zeepan run_cat $emitf1/out.zeewye run_mlr put -q '@a=$a; @b=$b; emitf | "tr \[a-z\] \[A-Z\]", @a, @b' $indir/abixy touch $emitf1/err1 run_mlr put -q '@a=$a; @b=$b; emitf > stdout, @a, @b' $indir/abixy 2> $emitf1/err1 run_cat $emitf1/err1 touch $emitf1/err2 run_mlr put -q '@a=$a; @b=$b; emitf > stderr, @a, @b' $indir/abixy 2> $emitf1/err2 run_cat $emitf1/err2 # ---------------------------------------------------------------- announce DSL EMITP REDIRECTS emitp1=$reloutdir/emitp1 mkdir -p $emitp1 run_mlr head -n 4 then put -q '@a[NR]=$a; @b[NR]=$b; emitp > "'$emitp1'/out.".$a.$b, @a' $indir/abixy run_cat $emitp1/out.ekspan run_cat $emitp1/out.ekswye run_cat $emitp1/out.panpan run_cat $emitp1/out.wyewye run_mlr head -n 4 then put -q '@a[NR]=$a; @b[NR]=$b; emitp > "'$emitp1'/out.".$a.$b, @a' $indir/abixy run_cat $emitp1/out.ekspan run_cat $emitp1/out.ekswye run_cat $emitp1/out.panpan run_cat $emitp1/out.wyewye run_mlr head -n 4 then put -q '@a[NR]=$a; @b[NR]=$b; emitp >> "'$emitp1'/out.".$a.$b, @a' $indir/abixy run_cat $emitp1/out.ekspan run_cat $emitp1/out.ekswye run_cat $emitp1/out.panpan run_cat $emitp1/out.wyewye run_mlr head -n 4 then put -q -o json '@a[NR]=$a; @b[NR]=$b; emitp > "'$emitp1'/out.".$a.$b, @a' $indir/abixy run_cat $emitp1/out.ekspan run_cat $emitp1/out.ekswye run_cat $emitp1/out.panpan run_cat $emitp1/out.wyewye run_mlr head -n 4 then put -q '@a[NR]=$a; @b[NR]=$b; emitp | "tr \[a-z\] \[A-Z\]", @a' $indir/abixy touch $emitp1/err1 run_mlr head -n 4 then put -q '@a[NR]=$a; @b[NR]=$b; emitp > stdout, @a' $indir/abixy 2> $emitp1/err1 run_cat $emitp1/err1 touch $emitp1/err2 run_mlr head -n 4 then put -q '@a[NR]=$a; @b[NR]=$b; emitp > stderr, @a' $indir/abixy 2> $emitp1/err2 run_cat $emitp1/err2 emitp2=$reloutdir/emitp2 mkdir -p $emitp2 run_mlr head -n 4 then put -q '@a[NR]=$a; @b[NR]=$b; emitp > "'$emitp2'/out.".$a.$b, @a, "NR"' $indir/abixy run_cat $emitp2/out.ekspan run_cat $emitp2/out.ekswye run_cat $emitp2/out.panpan run_cat $emitp2/out.wyewye run_mlr head -n 4 then put -q '@a[NR]=$a; @b[NR]=$b; emitp > "'$emitp2'/out.".$a.$b, @a, "NR"' $indir/abixy run_cat $emitp2/out.ekspan run_cat $emitp2/out.ekswye run_cat $emitp2/out.panpan run_cat $emitp2/out.wyewye run_mlr head -n 4 then put -q '@a[NR]=$a; @b[NR]=$b; emitp >> "'$emitp2'/out.".$a.$b, @a, "NR"' $indir/abixy run_cat $emitp2/out.ekspan run_cat $emitp2/out.ekswye run_cat $emitp2/out.panpan run_cat $emitp2/out.wyewye run_mlr head -n 4 then put -q -o json '@a[NR]=$a; @b[NR]=$b; emitp > "'$emitp2'/out.".$a.$b, @a, "NR"' $indir/abixy run_cat $emitp2/out.ekspan run_cat $emitp2/out.ekswye run_cat $emitp2/out.panpan run_cat $emitp2/out.wyewye run_mlr head -n 4 then put -q '@a[NR]=$a; @b[NR]=$b; emitp | "tr \[a-z\] \[A-Z\]", @a, "NR"' $indir/abixy touch $emitp2/err1 run_mlr head -n 4 then put -q '@a[NR]=$a; @b[NR]=$b; emitp > stdout, @a, "NR"' $indir/abixy 2> $emitp2/err1 run_cat $emitp2/err1 touch $emitp2/err2 run_mlr head -n 4 then put -q '@a[NR]=$a; @b[NR]=$b; emitp > stderr, @a, "NR"' $indir/abixy 2> $emitp2/err2 run_cat $emitp2/err2 emitp3=$reloutdir/emitp3 mkdir -p $emitp3 run_mlr head -n 4 then put -q '@a[NR]=$a; @b[NR]=$b; emitp > "'$emitp3'/out.".$a.$b, (@a, @b)' $indir/abixy run_cat $emitp3/out.ekspan run_cat $emitp3/out.ekswye run_cat $emitp3/out.panpan run_cat $emitp3/out.wyewye run_mlr head -n 4 then put -q '@a[NR]=$a; @b[NR]=$b; emitp > "'$emitp3'/out.".$a.$b, (@a, @b)' $indir/abixy run_cat $emitp3/out.ekspan run_cat $emitp3/out.ekswye run_cat $emitp3/out.panpan run_cat $emitp3/out.wyewye run_mlr head -n 4 then put -q '@a[NR]=$a; @b[NR]=$b; emitp >> "'$emitp3'/out.".$a.$b, (@a, @b)' $indir/abixy run_cat $emitp3/out.ekspan run_cat $emitp3/out.ekswye run_cat $emitp3/out.panpan run_cat $emitp3/out.wyewye run_mlr head -n 4 then put -q -o json '@a[NR]=$a; @b[NR]=$b; emitp > "'$emitp3'/out.".$a.$b, (@a, @b)' $indir/abixy run_cat $emitp3/out.ekspan run_cat $emitp3/out.ekswye run_cat $emitp3/out.panpan run_cat $emitp3/out.wyewye run_mlr head -n 4 then put -q '@a[NR]=$a; @b[NR]=$b; emitp | "tr \[a-z\] \[A-Z\]", (@a, @b)' $indir/abixy touch $emitp3/err1 run_mlr head -n 4 then put -q '@a[NR]=$a; @b[NR]=$b; emitp > stdout, (@a, @b)' $indir/abixy 2> $emitp3/err1 run_cat $emitp3/err1 touch $emitp3/err2 run_mlr head -n 4 then put -q '@a[NR]=$a; @b[NR]=$b; emitp > stderr, (@a, @b)' $indir/abixy 2> $emitp3/err2 run_cat $emitp3/err2 emitp4=$reloutdir/emitp4 mkdir -p $emitp4 run_mlr head -n 4 then put -q '@a[NR]=$a; @b[NR]=$b; emitp > "'$emitp4'/out.".$a.$b, (@a, @b), "NR"' $indir/abixy run_cat $emitp4/out.ekspan run_cat $emitp4/out.ekswye run_cat $emitp4/out.panpan run_cat $emitp4/out.wyewye run_mlr head -n 4 then put -q '@a[NR]=$a; @b[NR]=$b; emitp > "'$emitp4'/out.".$a.$b, (@a, @b), "NR"' $indir/abixy run_cat $emitp4/out.ekspan run_cat $emitp4/out.ekswye run_cat $emitp4/out.panpan run_cat $emitp4/out.wyewye run_mlr head -n 4 then put -q '@a[NR]=$a; @b[NR]=$b; emitp >> "'$emitp4'/out.".$a.$b, (@a, @b), "NR"' $indir/abixy run_cat $emitp4/out.ekspan run_cat $emitp4/out.ekswye run_cat $emitp4/out.panpan run_cat $emitp4/out.wyewye run_mlr head -n 4 then put -q -o json '@a[NR]=$a; @b[NR]=$b; emitp > "'$emitp4'/out.".$a.$b, (@a, @b), "NR"' $indir/abixy run_cat $emitp4/out.ekspan run_cat $emitp4/out.ekswye run_cat $emitp4/out.panpan run_cat $emitp4/out.wyewye run_mlr head -n 4 then put -q '@a[NR]=$a; @b[NR]=$b; emitp | "tr \[a-z\] \[A-Z\]", (@a, @b), "NR"' $indir/abixy touch $emitp4/err1 run_mlr head -n 4 then put -q '@a[NR]=$a; @b[NR]=$b; emitp > stdout, (@a, @b), "NR"' $indir/abixy 2> $emitp4/err1 run_cat $emitp4/err1 touch $emitp4/err2 run_mlr head -n 4 then put -q '@a[NR]=$a; @b[NR]=$b; emitp > stderr, (@a, @b), "NR"' $indir/abixy 2> $emitp4/err2 run_cat $emitp4/err2 emitp5=$reloutdir/emitp5 mkdir -p $emitp5 run_mlr head -n 4 then put -q '@a[NR]=$a; @b[NR]=$b; emitp > "'$emitp5'/out.".$a.$b, @*' $indir/abixy run_cat $emitp5/out.ekspan run_cat $emitp5/out.ekswye run_cat $emitp5/out.panpan run_cat $emitp5/out.wyewye run_mlr head -n 4 then put -q '@a[NR]=$a; @b[NR]=$b; emitp | "tr \[a-z\] \[A-Z\]", @*' $indir/abixy touch $emitp5/err1 run_mlr head -n 4 then put -q '@a[NR]=$a; @b[NR]=$b; emitp > stdout, @*' $indir/abixy 2> $emitp5/err1 run_cat $emitp5/err1 touch $emitp5/err2 run_mlr head -n 4 then put -q '@a[NR]=$a; @b[NR]=$b; emitp > stderr, @*' $indir/abixy 2> $emitp5/err2 run_cat $emitp5/err2 emitp6=$reloutdir/emitp6 mkdir -p $emitp6 run_mlr head -n 4 then put -q '@a[NR]=$a; @b[NR]=$b; emitp > "'$emitp6'/out.".$a.$b, all' $indir/abixy run_cat $emitp6/out.ekspan run_cat $emitp6/out.ekswye run_cat $emitp6/out.panpan run_cat $emitp6/out.wyewye run_mlr head -n 4 then put -q '@a[NR]=$a; @b[NR]=$b; emitp | "tr \[a-z\] \[A-Z\]", all' $indir/abixy touch $emitp6/err1 run_mlr head -n 4 then put -q '@a[NR]=$a; @b[NR]=$b; emitp > stdout, all' $indir/abixy 2> $emitp6/err1 run_cat $emitp6/err1 touch $emitp6/err2 run_mlr head -n 4 then put -q '@a[NR]=$a; @b[NR]=$b; emitp > stderr, all' $indir/abixy 2> $emitp6/err2 run_cat $emitp6/err2 emitp7=$reloutdir/emitp7 mkdir -p $emitp7 run_mlr head -n 4 then put -q '@a[NR]=$a; @b[NR]=$b; emitp > "'$emitp7'/out.".$a.$b, @*, "NR"' $indir/abixy run_cat $emitp7/out.ekspan run_cat $emitp7/out.ekswye run_cat $emitp7/out.panpan run_cat $emitp7/out.wyewye run_mlr head -n 4 then put -q '@a[NR]=$a; @b[NR]=$b; emitp | "tr \[a-z\] \[A-Z\]", @*, "NR"' $indir/abixy touch $emitp7/err1 run_mlr head -n 4 then put -q '@a[NR]=$a; @b[NR]=$b; emitp > stdout, @*, "NR"' $indir/abixy 2> $emitp7/err1 run_cat $emitp7/err1 touch $emitp7/err2 run_mlr head -n 4 then put -q '@a[NR]=$a; @b[NR]=$b; emitp > stderr, @*, "NR"' $indir/abixy 2> $emitp7/err2 run_cat $emitp7/err2 emitp8=$reloutdir/emitp8 mkdir -p $emitp8 run_mlr head -n 4 then put -q '@a[NR]=$a; @b[NR]=$b; emitp > "'$emitp8'/out.".$a.$b, all, "NR"' $indir/abixy run_cat $emitp8/out.ekspan run_cat $emitp8/out.ekswye run_cat $emitp8/out.panpan run_cat $emitp8/out.wyewye run_mlr head -n 4 then put -q '@a[NR]=$a; @b[NR]=$b; emitp | "tr \[a-z\] \[A-Z\]", all, "NR"' $indir/abixy touch $emitp8/err1 run_mlr head -n 4 then put -q '@a[NR]=$a; @b[NR]=$b; emitp > stdout, all, "NR"' $indir/abixy 2> $emitp8/err1 run_cat $emitp8/err1 touch $emitp8/err2 run_mlr head -n 4 then put -q '@a[NR]=$a; @b[NR]=$b; emitp > stderr, all, "NR"' $indir/abixy 2> $emitp8/err2 run_cat $emitp8/err2 # ---------------------------------------------------------------- announce DSL EMIT REDIRECTS emit1=$reloutdir/emit1 mkdir -p $emit1 run_mlr head -n 4 then put -q '@a[NR]=$a; @b[NR]=$b; emit > "'$emit1'/out.".$a.$b, @a' $indir/abixy run_cat $emit1/out.ekspan run_cat $emit1/out.ekswye run_cat $emit1/out.panpan run_cat $emit1/out.wyewye run_mlr head -n 4 then put -q '@a[NR]=$a; @b[NR]=$b; emit > "'$emit1'/out.".$a.$b, @a' $indir/abixy run_cat $emit1/out.ekspan run_cat $emit1/out.ekswye run_cat $emit1/out.panpan run_cat $emit1/out.wyewye run_mlr head -n 4 then put -q '@a[NR]=$a; @b[NR]=$b; emit >> "'$emit1'/out.".$a.$b, @a' $indir/abixy run_cat $emit1/out.ekspan run_cat $emit1/out.ekswye run_cat $emit1/out.panpan run_cat $emit1/out.wyewye run_mlr head -n 4 then put -q -o json '@a[NR]=$a; @b[NR]=$b; emit > "'$emit1'/out.".$a.$b, @a' $indir/abixy run_cat $emit1/out.ekspan run_cat $emit1/out.ekswye run_cat $emit1/out.panpan run_cat $emit1/out.wyewye run_mlr head -n 4 then put -q '@a[NR]=$a; @b[NR]=$b; emit | "tr \[a-z\] \[A-Z\]", @a' $indir/abixy touch $emit1/err1 run_mlr head -n 4 then put -q '@a[NR]=$a; @b[NR]=$b; emit > stdout, @a' $indir/abixy 2> $emit1/err1 run_cat $emit1/err1 touch $emit1/err2 run_mlr head -n 4 then put -q '@a[NR]=$a; @b[NR]=$b; emit > stderr, @a' $indir/abixy 2> $emit1/err2 run_cat $emit1/err2 emit2=$reloutdir/emit2 mkdir -p $emit2 run_mlr head -n 4 then put -q '@a[NR]=$a; @b[NR]=$b; emit > "'$emit2'/out.".$a.$b, @a, "NR"' $indir/abixy run_cat $emit2/out.ekspan run_cat $emit2/out.ekswye run_cat $emit2/out.panpan run_cat $emit2/out.wyewye run_mlr head -n 4 then put -q '@a[NR]=$a; @b[NR]=$b; emit > "'$emit2'/out.".$a.$b, @a, "NR"' $indir/abixy run_cat $emit2/out.ekspan run_cat $emit2/out.ekswye run_cat $emit2/out.panpan run_cat $emit2/out.wyewye run_mlr head -n 4 then put -q '@a[NR]=$a; @b[NR]=$b; emit >> "'$emit2'/out.".$a.$b, @a, "NR"' $indir/abixy run_cat $emit2/out.ekspan run_cat $emit2/out.ekswye run_cat $emit2/out.panpan run_cat $emit2/out.wyewye run_mlr head -n 4 then put -q -o pprint '@a[NR]=$a; @b[NR]=$b; emit > "'$emit2'/out.".$a.$b, @a, "NR"' $indir/abixy run_cat $emit2/out.ekspan run_cat $emit2/out.ekswye run_cat $emit2/out.panpan run_cat $emit2/out.wyewye run_mlr head -n 4 then put -q '@a[NR]=$a; @b[NR]=$b; emit | "tr \[a-z\] \[A-Z\]", @a, "NR"' $indir/abixy touch $emit2/err1 run_mlr head -n 4 then put -q '@a[NR]=$a; @b[NR]=$b; emit > stdout, @a, "NR"' $indir/abixy 2> $emit2/err1 run_cat $emit2/err1 touch $emit2/err2 run_mlr head -n 4 then put -q '@a[NR]=$a; @b[NR]=$b; emit > stderr, @a, "NR"' $indir/abixy 2> $emit2/err2 run_cat $emit2/err2 emit3=$reloutdir/emit3 mkdir -p $emit3 run_mlr head -n 4 then put -q '@a[NR]=$a; @b[NR]=$b; emit > "'$emit3'/out.".$a.$b, (@a, @b)' $indir/abixy run_cat $emit3/out.ekspan run_cat $emit3/out.ekswye run_cat $emit3/out.panpan run_cat $emit3/out.wyewye run_mlr head -n 4 then put -q '@a[NR]=$a; @b[NR]=$b; emit > "'$emit3'/out.".$a.$b, (@a, @b)' $indir/abixy run_cat $emit3/out.ekspan run_cat $emit3/out.ekswye run_cat $emit3/out.panpan run_cat $emit3/out.wyewye run_mlr head -n 4 then put -q '@a[NR]=$a; @b[NR]=$b; emit >> "'$emit3'/out.".$a.$b, (@a, @b)' $indir/abixy run_cat $emit3/out.ekspan run_cat $emit3/out.ekswye run_cat $emit3/out.panpan run_cat $emit3/out.wyewye run_mlr head -n 4 then put -q --oxtab '@a[NR]=$a; @b[NR]=$b; emit > "'$emit3'/out.".$a.$b, (@a, @b)' $indir/abixy run_cat $emit3/out.ekspan run_cat $emit3/out.ekswye run_cat $emit3/out.panpan run_cat $emit3/out.wyewye run_mlr head -n 4 then put -q '@a[NR]=$a; @b[NR]=$b; emit | "tr \[a-z\] \[A-Z\]", (@a, @b)' $indir/abixy touch $emit3/err1 run_mlr head -n 4 then put -q '@a[NR]=$a; @b[NR]=$b; emit > stdout, (@a, @b)' $indir/abixy 2> $emit3/err1 run_cat $emit3/err1 touch $emit3/err2 run_mlr head -n 4 then put -q '@a[NR]=$a; @b[NR]=$b; emit > stderr, (@a, @b)' $indir/abixy 2> $emit3/err2 run_cat $emit3/err2 emit4=$reloutdir/emit4 mkdir -p $emit4 run_mlr head -n 4 then put -q '@a[NR]=$a; @b[NR]=$b; emit > "'$emit4'/out.".$a.$b, (@a, @b), "NR"' $indir/abixy run_cat $emit4/out.ekspan run_cat $emit4/out.ekswye run_cat $emit4/out.panpan run_cat $emit4/out.wyewye run_mlr head -n 4 then put -q '@a[NR]=$a; @b[NR]=$b; emit > "'$emit4'/out.".$a.$b, (@a, @b), "NR"' $indir/abixy run_cat $emit4/out.ekspan run_cat $emit4/out.ekswye run_cat $emit4/out.panpan run_cat $emit4/out.wyewye run_mlr head -n 4 then put -q '@a[NR]=$a; @b[NR]=$b; emit >> "'$emit4'/out.".$a.$b, (@a, @b), "NR"' $indir/abixy run_cat $emit4/out.ekspan run_cat $emit4/out.ekswye run_cat $emit4/out.panpan run_cat $emit4/out.wyewye run_mlr head -n 4 then put -q --ojson '@a[NR]=$a; @b[NR]=$b; emit > "'$emit4'/out.".$a.$b, (@a, @b), "NR"' $indir/abixy run_cat $emit4/out.ekspan run_cat $emit4/out.ekswye run_cat $emit4/out.panpan run_cat $emit4/out.wyewye run_mlr head -n 4 then put -q '@a[NR]=$a; @b[NR]=$b; emit | "tr \[a-z\] \[A-Z\]", (@a, @b), "NR"' $indir/abixy touch $emit4/err1 run_mlr head -n 4 then put -q '@a[NR]=$a; @b[NR]=$b; emit > stdout, (@a, @b), "NR"' $indir/abixy 2> $emit4/err1 run_cat $emit4/err1 touch $emit4/err2 run_mlr head -n 4 then put -q '@a[NR]=$a; @b[NR]=$b; emit > stderr, (@a, @b), "NR"' $indir/abixy 2> $emit4/err2 run_cat $emit4/err2 emit5=$reloutdir/emit5 mkdir -p $emit5 run_mlr head -n 4 then put -q '@a[NR]=$a; @b[NR]=$b; emit > "'$emit5'/out.".$a.$b, @*' $indir/abixy run_cat $emit5/out.ekspan run_cat $emit5/out.ekswye run_cat $emit5/out.panpan run_cat $emit5/out.wyewye run_mlr head -n 4 then put -q '@a[NR]=$a; @b[NR]=$b; emit | "tr \[a-z\] \[A-Z\]", @*' $indir/abixy touch $emit5/err1 run_mlr head -n 4 then put -q '@a[NR]=$a; @b[NR]=$b; emit > stdout, @*' $indir/abixy 2> $emit5/err1 run_cat $emit5/err1 touch $emit5/err2 run_mlr head -n 4 then put -q '@a[NR]=$a; @b[NR]=$b; emit > stderr, @*' $indir/abixy 2> $emit5/err2 run_cat $emit5/err2 emit6=$reloutdir/emit6 mkdir -p $emit6 run_mlr head -n 4 then put -q '@a[NR]=$a; @b[NR]=$b; emit > "'$emit6'/out.".$a.$b, all' $indir/abixy run_cat $emit6/out.ekspan run_cat $emit6/out.ekswye run_cat $emit6/out.panpan run_cat $emit6/out.wyewye run_mlr head -n 4 then put -q '@a[NR]=$a; @b[NR]=$b; emit | "tr \[a-z\] \[A-Z\]", all' $indir/abixy touch $emit6/err1 run_mlr head -n 4 then put -q '@a[NR]=$a; @b[NR]=$b; emit > stdout, all' $indir/abixy 2> $emit6/err1 run_cat $emit6/err1 touch $emit6/err2 run_mlr head -n 4 then put -q '@a[NR]=$a; @b[NR]=$b; emit > stderr, all' $indir/abixy 2> $emit6/err2 run_cat $emit6/err2 emit7=$reloutdir/emit7 mkdir -p $emit7 run_mlr head -n 4 then put -q '@a[NR]=$a; @b[NR]=$b; emit > "'$emit7'/out.".$a.$b, @*, "NR"' $indir/abixy run_cat $emit7/out.ekspan run_cat $emit7/out.ekswye run_cat $emit7/out.panpan run_cat $emit7/out.wyewye run_mlr head -n 4 then put -q '@a[NR]=$a; @b[NR]=$b; emit | "tr \[a-z\] \[A-Z\]", @*, "NR"' $indir/abixy touch $emit7/err1 run_mlr head -n 4 then put -q '@a[NR]=$a; @b[NR]=$b; emit > stdout, @*, "NR"' $indir/abixy 2> $emit7/err1 run_cat $emit7/err1 touch $emit7/err2 run_mlr head -n 4 then put -q '@a[NR]=$a; @b[NR]=$b; emit > stderr, @*, "NR"' $indir/abixy 2> $emit7/err2 run_cat $emit7/err2 emit8=$reloutdir/emit8 mkdir -p $emit8 run_mlr head -n 4 then put -q '@a[NR]=$a; @b[NR]=$b; emit > "'$emit8'/out.".$a.$b, all, "NR"' $indir/abixy run_cat $emit8/out.ekspan run_cat $emit8/out.ekswye run_cat $emit8/out.panpan run_cat $emit8/out.wyewye run_mlr head -n 4 then put -q '@a[NR]=$a; @b[NR]=$b; emit | "tr \[a-z\] \[A-Z\]", all, "NR"' $indir/abixy touch $emit8/err1 run_mlr head -n 4 then put -q '@a[NR]=$a; @b[NR]=$b; emit > stdout, all, "NR"' $indir/abixy 2> $emit8/err1 run_cat $emit8/err1 touch $emit8/err2 run_mlr head -n 4 then put -q '@a[NR]=$a; @b[NR]=$b; emit > stderr, all, "NR"' $indir/abixy 2> $emit8/err2 run_cat $emit8/err2 # ---------------------------------------------------------------- announce OOSVAR-FROM-SREC ASSIGNMENT run_mlr put -v '@v = $*' /dev/null run_mlr put -v '@v[1] = $*' /dev/null run_mlr put -v '@v[$2] = $*' /dev/null run_mlr put -v 'NR == 3 {@v = $*}' /dev/null run_mlr put -v 'NR == 3 {@v[1] = $*}' /dev/null run_mlr put -v 'NR == 3 {@v[$2] = $*}' /dev/null run_mlr --oxtab put -q '@v = $*; end {emitp @v }' $indir/abixy-het run_mlr --oxtab put -q '@v[$a] = $*; end {emitp @v }' $indir/abixy-het run_mlr --oxtab put -q '@v[$a] = $*; end {emitp @v, "a" }' $indir/abixy-het run_mlr --oxtab put -q '@v[$a][$b] = $*; end {emitp @v }' $indir/abixy-het run_mlr --oxtab put -q '@v[$a][$b] = $*; end {emitp @v, "a" }' $indir/abixy-het run_mlr --oxtab put -q '@v[$a][$b] = $*; end {emitp @v, "a", "b"}' $indir/abixy-het # ---------------------------------------------------------------- announce SREC-FROM-OOSVAR ASSIGNMENT run_mlr put -v '$* = @v ' /dev/null run_mlr put -v '$* = @v[1] ' /dev/null run_mlr put -v '$* = @v[$2]' /dev/null run_mlr put -v 'NR == 3 {$* = @v }' /dev/null run_mlr put -v 'NR == 3 {$* = @v[1] }' /dev/null run_mlr put -v 'NR == 3 {$* = @v[$2]}' /dev/null run_mlr put '@v[NR] = $a; NR == 7 { @v = $*} ; $* = @v' $indir/abixy-het # ---------------------------------------------------------------- announce OOSVAR-FROM-OOSVAR ASSIGNMENT run_mlr put -v '@u = @v' /dev/null run_mlr put -v '@u = @v[1]' /dev/null run_mlr put -v '@u[2] = @v' /dev/null run_mlr put -v '@u[2] = @v[1]' /dev/null run_mlr put -v 'begin { @u = @v }' /dev/null run_mlr put -v 'begin { @u = @v[1] }' /dev/null run_mlr put -v 'begin { @u[2] = @v }' /dev/null run_mlr put -v 'begin { @u[2] = @v[1] }' /dev/null run_mlr put -v 'NR == 3 { @u = @v }' /dev/null run_mlr put -v 'NR == 3 { @u = @v[1] }' /dev/null run_mlr put -v 'NR == 3 { @u[2] = @v }' /dev/null run_mlr put -v 'NR == 3 { @u[2] = @v[1] }' /dev/null run_mlr put -v 'end { @u = @v }' /dev/null run_mlr put -v 'end { @u = @v[1] }' /dev/null run_mlr put -v 'end { @u[2] = @v }' /dev/null run_mlr put -v 'end { @u[2] = @v[1] }' /dev/null run_mlr put -q '@s += $i; @t=@s; end{dump; emitp@s; emitp @t}' $indir/abixy run_mlr put -q '@s[1] += $i; @t=@s; end{dump; emitp@s; emitp @t}' $indir/abixy run_mlr put -q '@s[1] += $i; @t=@s[1]; end{dump; emitp@s; emitp @t}' $indir/abixy run_mlr put -q '@s[1] += $i; @t[3]=@s; end{dump; emitp@s; emitp @t}' $indir/abixy run_mlr put -q '@s[1] += $i; @t[3]=@s[1]; end{dump; emitp@s; emitp @t}' $indir/abixy run_mlr put -q '@s[1][2] += $i; @t=@s; end{dump; emitp@s; emitp @t}' $indir/abixy run_mlr put -q '@s[1][2] += $i; @t=@s[1]; end{dump; emitp@s; emitp @t}' $indir/abixy run_mlr put -q '@s[1][2] += $i; @t=@s[1][2]; end{dump; emitp@s; emitp @t}' $indir/abixy run_mlr put -q '@s[1][2] += $i; @t[3]=@s; end{dump; emitp@s; emitp @t}' $indir/abixy run_mlr put -q '@s[1][2] += $i; @t[3]=@s[1]; end{dump; emitp@s; emitp @t}' $indir/abixy run_mlr put -q '@s[1][2] += $i; @t[3]=@s[1][2]; end{dump; emitp@s; emitp @t}' $indir/abixy run_mlr put -q '@s[1][2] += $i; @t[3][4]=@s; end{dump; emitp@s; emitp @t}' $indir/abixy run_mlr put -q '@s[1][2] += $i; @t[3][4]=@s[1]; end{dump; emitp@s; emitp @t}' $indir/abixy run_mlr put -q '@s[1][2] += $i; @t[3][4]=@s[1][2]; end{dump; emitp@s; emitp @t}' $indir/abixy run_mlr --opprint put -q '@s[NR][NR] = $i/100; @t[NR*10]=@s; end{emitp@s,"A","B"; emitp @t,"C","D","E"}' $indir/abixy # ---------------------------------------------------------------- announce CHAINING run_mlr cat then cat $indir/short run_mlr cat then tac $indir/short run_mlr tac then cat $indir/short run_mlr tac then tac $indir/short run_mlr cat then cat then cat $indir/short run_mlr cat then cat then tac $indir/short run_mlr cat then tac then cat $indir/short run_mlr cat then tac then tac $indir/short run_mlr tac then cat then cat $indir/short run_mlr tac then cat then tac $indir/short run_mlr tac then tac then cat $indir/short run_mlr tac then tac then tac $indir/short # ---------------------------------------------------------------- announce NUMBER FORMATTING run_mlr --opprint stats1 -a sum -f x $indir/ofmt.dat run_mlr --ofmt '%.3lf' --opprint stats1 -a sum -f x $indir/ofmt.dat run_mlr --opprint --ofmt '%.3lf' stats1 -a sum -f x $indir/ofmt.dat # ---------------------------------------------------------------- announce IMPLICIT-HEADER-CSV INPUT run_mlr --irs crlf --no-mmap --icsvlite --ifs , --opprint cut -x -f b/ $indir/multi-sep.csv run_mlr --irs crlf --implicit-csv-header --no-mmap --icsvlite --ifs , --opprint cut -x -f 2 $indir/multi-sep.csv run_mlr --irs crlf --no-mmap --icsvlite --ifs /, --opprint cut -x -f b $indir/multi-sep.csv run_mlr --irs crlf --implicit-csv-header --no-mmap --icsvlite --ifs /, --opprint cut -x -f 2 $indir/multi-sep.csv run_mlr --irs crlf --mmap --icsvlite --ifs , --opprint cut -x -f b/ $indir/multi-sep.csv run_mlr --irs crlf --implicit-csv-header --mmap --icsvlite --ifs , --opprint cut -x -f 2 $indir/multi-sep.csv run_mlr --irs crlf --mmap --icsvlite --ifs /, --opprint cut -x -f b $indir/multi-sep.csv run_mlr --irs crlf --implicit-csv-header --mmap --icsvlite --ifs /, --opprint cut -x -f 2 $indir/multi-sep.csv run_mlr --icsv --ifs , --opprint cut -x -f b/ $indir/multi-sep.csv run_mlr --implicit-csv-header --icsv --ifs , --opprint cut -x -f 2 $indir/multi-sep.csv run_mlr --icsv --ifs /, --opprint cut -x -f b $indir/multi-sep.csv run_mlr --implicit-csv-header --icsv --ifs /, --opprint cut -x -f 2 $indir/multi-sep.csv # ---------------------------------------------------------------- announce HET-CSV INPUT run_mlr --icsvlite --odkvp cat $indir/a.csv run_mlr --icsvlite --odkvp cat $indir/b.csv run_mlr --icsvlite --odkvp cat $indir/c.csv run_mlr --icsvlite --odkvp cat $indir/d.csv run_mlr --icsvlite --odkvp cat $indir/e.csv run_mlr --icsvlite --odkvp cat $indir/f.csv run_mlr --icsvlite --odkvp cat $indir/g.csv run_mlr --icsvlite --odkvp cat $indir/a.csv $indir/a.csv run_mlr --icsvlite --odkvp cat $indir/b.csv $indir/b.csv run_mlr --icsvlite --odkvp cat $indir/c.csv $indir/c.csv run_mlr --icsvlite --odkvp cat $indir/d.csv $indir/d.csv run_mlr --icsvlite --odkvp cat $indir/e.csv $indir/e.csv run_mlr --icsvlite --odkvp cat $indir/f.csv $indir/f.csv run_mlr --icsvlite --odkvp cat $indir/g.csv $indir/g.csv run_mlr --icsvlite --odkvp cat $indir/a.csv $indir/b.csv run_mlr --icsvlite --odkvp cat $indir/b.csv $indir/c.csv run_mlr --icsvlite --odkvp cat $indir/c.csv $indir/d.csv run_mlr --icsvlite --odkvp cat $indir/d.csv $indir/e.csv run_mlr --icsvlite --odkvp cat $indir/e.csv $indir/f.csv run_mlr --icsvlite --odkvp cat $indir/f.csv $indir/g.csv run_mlr --icsvlite --odkvp cat $indir/a.csv $indir/b.csv \ $indir/c.csv $indir/d.csv $indir/e.csv $indir/f.csv $indir/g.csv run_mlr --icsvlite --odkvp tac $indir/het.csv run_mlr --headerless-csv-output --csvlite tac $indir/a.csv run_mlr --headerless-csv-output --csvlite tac $indir/c.csv run_mlr --headerless-csv-output --csvlite tac $indir/a.csv $indir/c.csv run_mlr --headerless-csv-output --csvlite tac $indir/het.csv run_mlr --headerless-csv-output --csvlite group-like $indir/het.csv # ---------------------------------------------------------------- announce HET-PPRINT INPUT run_mlr --ipprint --odkvp cat $indir/a.pprint run_mlr --ipprint --odkvp cat $indir/b.pprint run_mlr --ipprint --odkvp cat $indir/c.pprint run_mlr --ipprint --odkvp cat $indir/d.pprint run_mlr --ipprint --odkvp cat $indir/e.pprint run_mlr --ipprint --odkvp cat $indir/f.pprint run_mlr --ipprint --odkvp cat $indir/g.pprint run_mlr --ipprint --odkvp cat $indir/a.pprint $indir/a.pprint run_mlr --ipprint --odkvp cat $indir/b.pprint $indir/b.pprint run_mlr --ipprint --odkvp cat $indir/c.pprint $indir/c.pprint run_mlr --ipprint --odkvp cat $indir/d.pprint $indir/d.pprint run_mlr --ipprint --odkvp cat $indir/e.pprint $indir/e.pprint run_mlr --ipprint --odkvp cat $indir/f.pprint $indir/f.pprint run_mlr --ipprint --odkvp cat $indir/g.pprint $indir/g.pprint run_mlr --ipprint --odkvp cat $indir/a.pprint $indir/b.pprint run_mlr --ipprint --odkvp cat $indir/b.pprint $indir/c.pprint run_mlr --ipprint --odkvp cat $indir/c.pprint $indir/d.pprint run_mlr --ipprint --odkvp cat $indir/d.pprint $indir/e.pprint run_mlr --ipprint --odkvp cat $indir/e.pprint $indir/f.pprint run_mlr --ipprint --odkvp cat $indir/f.pprint $indir/g.pprint run_mlr --ipprint --odkvp cat $indir/a.pprint $indir/b.pprint \ $indir/c.pprint $indir/d.pprint $indir/e.pprint $indir/f.pprint $indir/g.pprint # ---------------------------------------------------------------- announce NULL-FIELD INPUT run_mlr --icsvlite --odkvp cat $indir/null-fields.csv run_mlr --inidx --ifs comma --odkvp cat $indir/null-fields.nidx run_mlr --idkvp --oxtab cat $indir/missings.dkvp run_mlr --oxtab stats1 -a sum,min,max,mode -f x $indir/nullvals.dkvp run_mlr --oxtab stats1 -a sum,min,max,mode -f y $indir/nullvals.dkvp run_mlr --oxtab stats1 -a sum,min,max,mode -f z $indir/nullvals.dkvp run_mlr --oxtab stats1 -a sum,min,max,mode -f x,y,z $indir/nullvals.dkvp run_mlr --oxtab stats1 -a sum,min,max,mode -f x -g a $indir/nullvals.dkvp run_mlr --oxtab stats1 -a sum,min,max,mode -f y -g a $indir/nullvals.dkvp run_mlr --oxtab stats1 -a sum,min,max,mode -f z -g a $indir/nullvals.dkvp run_mlr --oxtab stats1 -a sum,min,max,mode -f x,y,z -g a $indir/nullvals.dkvp run_mlr --opprint merge-fields -a sum,min,max,mode -f x,y,z -o xyz $indir/nullvals.dkvp run_mlr --opprint merge-fields -a sum,min,max,mode -r x,y,z -o xyz $indir/nullvals.dkvp run_mlr --opprint merge-fields -a sum,min,max,mode -c x,y,z $indir/nullvals.dkvp run_mlr --oxtab stats2 -a cov -f x,y $indir/nullvals.dkvp run_mlr --oxtab stats2 -a cov -f x,z $indir/nullvals.dkvp run_mlr --oxtab stats2 -a cov -f y,z $indir/nullvals.dkvp run_mlr --oxtab stats2 -a cov -f x,y -g a $indir/nullvals.dkvp run_mlr --oxtab stats2 -a cov -f x,z -g a $indir/nullvals.dkvp run_mlr --oxtab stats2 -a cov -f y,z -g a $indir/nullvals.dkvp run_mlr --opprint top -n 5 -f x $indir/nullvals.dkvp run_mlr --opprint top -n 5 -f y $indir/nullvals.dkvp run_mlr --opprint top -n 5 -f z $indir/nullvals.dkvp run_mlr --opprint top -n 5 -f x,y,z $indir/nullvals.dkvp run_mlr --opprint top -n 5 -f x -g a $indir/nullvals.dkvp run_mlr --opprint top -n 5 -f y -g a $indir/nullvals.dkvp run_mlr --opprint top -n 5 -f z -g a $indir/nullvals.dkvp run_mlr --opprint top -n 5 -f x,y,z -g a $indir/nullvals.dkvp run_mlr --opprint top -a -n 5 -f x $indir/nullvals.dkvp run_mlr --opprint top -a -n 5 -f y $indir/nullvals.dkvp run_mlr --opprint top -a -n 5 -f z $indir/nullvals.dkvp run_mlr --opprint top -a -n 5 -f x -g a $indir/nullvals.dkvp run_mlr --opprint top -a -n 5 -f y -g a $indir/nullvals.dkvp run_mlr --opprint top -a -n 5 -f z -g a $indir/nullvals.dkvp run_mlr --opprint step -a counter,rsum -f x $indir/nullvals.dkvp run_mlr --opprint step -a counter,rsum -f y $indir/nullvals.dkvp run_mlr --opprint step -a counter,rsum -f z $indir/nullvals.dkvp run_mlr --opprint step -a counter,rsum -f x,y,z $indir/nullvals.dkvp run_mlr --opprint step -a counter,rsum -f x -g a $indir/nullvals.dkvp run_mlr --opprint step -a counter,rsum -f y -g a $indir/nullvals.dkvp run_mlr --opprint step -a counter,rsum -f z -g a $indir/nullvals.dkvp run_mlr --opprint step -a counter,rsum -f x,y,z -g a $indir/nullvals.dkvp # ---------------------------------------------------------------- announce SPACE-PADDING run_mlr --mmap --idkvp --odkvp --ifs space --repifs cat $indir/space-pad.dkvp run_mlr --no-mmap --idkvp --odkvp --ifs space --repifs cat $indir/space-pad.dkvp run_mlr --mmap --inidx --odkvp --ifs space --repifs cat $indir/space-pad.nidx run_mlr --no-mmap --inidx --odkvp --ifs space --repifs cat $indir/space-pad.nidx run_mlr --mmap --icsvlite --odkvp --ifs space --repifs cat $indir/space-pad.pprint run_mlr --no-mmap --icsvlite --odkvp --ifs space --repifs cat $indir/space-pad.pprint # ---------------------------------------------------------------- announce DOUBLE PS run_mlr --no-mmap --opprint cat $indir/double-ps.dkvp run_mlr --mmap --opprint cat $indir/double-ps.dkvp # ---------------------------------------------------------------- announce MISSING FINAL LF run_mlr --no-mmap --csvlite cat $indir/truncated.csv run_mlr --csvlite cat $indir/truncated.csv run_mlr --no-mmap --dkvp cat $indir/truncated.dkvp run_mlr --dkvp cat $indir/truncated.dkvp run_mlr --no-mmap --nidx cat $indir/truncated.nidx run_mlr --nidx cat $indir/truncated.nidx run_mlr --no-mmap --pprint cat $indir/truncated.pprint run_mlr --pprint cat $indir/truncated.pprint run_mlr --no-mmap --xtab cat $indir/truncated.xtab run_mlr --xtab cat $indir/truncated.xtab # ---------------------------------------------------------------- announce UTF-8 alignment run_mlr --icsvlite --opprint cat $indir/utf8-1.csv run_mlr --icsvlite --opprint cat $indir/utf8-2.csv run_mlr --icsvlite --oxtab cat $indir/utf8-1.csv run_mlr --icsvlite --oxtab cat $indir/utf8-2.csv run_mlr --inidx --ifs space --opprint cat $indir/utf8-align.nidx run_mlr --inidx --ifs space --opprint --right cat $indir/utf8-align.nidx run_mlr --oxtab cat $indir/utf8-align.dkvp run_mlr --inidx --ifs space --oxtab --xvright cat $indir/utf8-align.nidx # ---------------------------------------------------------------- announce MMAP AT PAGE BOUNDARIES run_mlr --dkvp tail -n 4 $indir/page-aligned-final-ifs.dkvp run_mlr --dkvp tail -n 4 $indir/page-aligned-final-irs.dkvp run_mlr --dkvp tail -n 4 $indir/page-aligned-final-no-ifs.dkvp run_mlr --dkvp tail -n 4 $indir/page-aligned-no-final-irs.dkvp run_mlr --nidx tail -n 4 $indir/page-aligned-no-final-irs.nidx run_mlr --csvlite tail -n 4 $indir/page-aligned-no-final-irs.csvl run_mlr --csv --rs lf tail -n 4 $indir/page-aligned-no-final-irs.csvl run_mlr --xtab tail -n 4 $indir/page-aligned-no-final-eol.xtab # ---------------------------------------------------------------- announce INT64 I/O run_mlr --oxtab put '$c=$a;$d=$b;$e=hexfmt($a);$f=hexfmt($b)' $indir/int64io.dkvp # There is different rounding on i386 vs. x86_64 but the essential check is # that overflow has been avoided. Hence the %g output format here. run_mlr --oxtab --ofmt '%.8g' put '$p0=$p+0;$p1=$p+1;$p2=$p+2;$p3=$p+3' $indir/int64arith.dkvp run_mlr --oxtab --ofmt '%.8g' put '$p0=$p-0;$p1=$p-1;$p2=$p-2;$p3=$p-3' $indir/int64arith.dkvp run_mlr --oxtab --ofmt '%.8g' put '$p0=$p*0;$p1=$p*1;$p2=$p*2;$p3=$p*3' $indir/int64arith.dkvp run_mlr --oxtab --ofmt '%.8g' put '$n0=$n+0;$n1=$n+1;$n2=$n+2;$n3=$n+3' $indir/int64arith.dkvp run_mlr --oxtab --ofmt '%.8g' put '$n0=$n-0;$n1=$n-1;$n2=$n-2;$n3=$n-3' $indir/int64arith.dkvp run_mlr --oxtab --ofmt '%.8g' put '$n0=$n*0;$n1=$n*1;$n2=$n*2;$n3=$n*3' $indir/int64arith.dkvp # ---------------------------------------------------------------- announce COMPRESSED INPUT run_mlr --csv --prepipe 'cat' cat $indir/rfc-csv/simple.csv run_mlr --dkvp --prepipe 'cat' cat $indir/abixy run_mlr --csv --prepipe 'cat' cat < $indir/rfc-csv/simple.csv run_mlr --dkvp --prepipe 'cat' cat < $indir/abixy # ---------------------------------------------------------------- announce STDIN run_mlr --csv cat < $indir/rfc-csv/simple.csv # ---------------------------------------------------------------- announce RFC-CSV run_mlr --no-mmap --csv cat $indir/rfc-csv/simple.csv run_mlr --mmap --csv cat $indir/rfc-csv/simple.csv run_mlr --no-mmap --csv cat $indir/rfc-csv/simple-truncated.csv run_mlr --mmap --csv cat $indir/rfc-csv/simple-truncated.csv run_mlr --no-mmap --csv cat $indir/rfc-csv/narrow.csv run_mlr --mmap --csv cat $indir/rfc-csv/narrow.csv run_mlr --no-mmap --csv cat $indir/rfc-csv/narrow-truncated.csv run_mlr --mmap --csv cat $indir/rfc-csv/narrow-truncated.csv run_mlr --no-mmap --csv cat $indir/rfc-csv/quoted-comma.csv run_mlr --mmap --csv cat $indir/rfc-csv/quoted-comma.csv run_mlr --no-mmap --csv cat $indir/rfc-csv/quoted-comma-truncated.csv run_mlr --mmap --csv cat $indir/rfc-csv/quoted-comma-truncated.csv run_mlr --no-mmap --csv cat $indir/rfc-csv/quoted-crlf.csv run_mlr --mmap --csv cat $indir/rfc-csv/quoted-crlf.csv run_mlr --no-mmap --csv cat $indir/rfc-csv/quoted-crlf-truncated.csv run_mlr --mmap --csv cat $indir/rfc-csv/quoted-crlf-truncated.csv run_mlr --no-mmap --csv cat $indir/rfc-csv/simple-truncated.csv $indir/rfc-csv/simple.csv run_mlr --mmap --csv cat $indir/rfc-csv/simple-truncated.csv $indir/rfc-csv/simple.csv run_mlr --no-mmap --csv --ifs semicolon --ofs pipe --irs lf --ors lflf cut -x -f b $indir/rfc-csv/modify-defaults.csv run_mlr --mmap --csv --ifs semicolon --ofs pipe --irs lf --ors lflf cut -x -f b $indir/rfc-csv/modify-defaults.csv run_mlr --no-mmap --csv --rs lf --quote-original cut -o -f c,b,a $indir/quote-original.csv run_mlr --mmap --csv --rs lf --quote-original cut -o -f c,b,a $indir/quote-original.csv run_mlr --csv --quote-all cat $indir/rfc-csv/simple.csv run_mlr --csv --quote-original cat $indir/rfc-csv/simple.csv run_mlr --itsv --rs lf --oxtab cat $indir/simple.tsv # ---------------------------------------------------------------- announce MARKDOWN OUTPUT run_mlr --itsv --rs lf --omd cat $indir/simple.tsv # ---------------------------------------------------------------- announce CSV/RS ENVIRONMENT DEFAULTS run_mlr --csv cut -f a $indir/rfc-csv/simple.csv run_mlr --csv --rs crlf cut -f a $indir/rfc-csv/simple.csv mlr_expect_fail --csv --rs lf cut -f a $indir/rfc-csv/simple.csv export MLR_CSV_DEFAULT_RS=lf; mlr_expect_fail --csv cut -f a $indir/rfc-csv/simple.csv export MLR_CSV_DEFAULT_RS=lf; run_mlr --csv --rs crlf cut -f a $indir/rfc-csv/simple.csv export MLR_CSV_DEFAULT_RS=lf; mlr_expect_fail --csv --rs lf cut -f a $indir/rfc-csv/simple.csv export MLR_CSV_DEFAULT_RS=crlf; run_mlr --csv cut -f a $indir/rfc-csv/simple.csv export MLR_CSV_DEFAULT_RS=crlf; run_mlr --csv --rs crlf cut -f a $indir/rfc-csv/simple.csv export MLR_CSV_DEFAULT_RS=crlf; mlr_expect_fail --csv --rs lf cut -f a $indir/rfc-csv/simple.csv export MLR_CSV_DEFAULT_RS= # ---------------------------------------------------------------- announce MULTI-CHARACTER IRS/IFS/IPS FOR DKVP run_mlr --oxtab --idkvp --mmap --irs lf --ifs , --ips = cut -o -f x,a,i $indir/multi-sep.dkvp run_mlr --oxtab --idkvp --mmap --irs lf --ifs /, --ips =: cut -o -f x,a,i $indir/multi-sep.dkvp run_mlr --oxtab --idkvp --mmap --irs crlf --ifs , --ips = cut -o -f x,a,i $indir/multi-sep.dkvp run_mlr --oxtab --idkvp --mmap --irs crlf --ifs /, --ips =: cut -o -f x,a,i $indir/multi-sep.dkvp run_mlr --oxtab --no-mmap --irs lf --ifs , --ips = cut -o -f x,a,i $indir/multi-sep.dkvp run_mlr --oxtab --no-mmap --irs lf --ifs /, --ips =: cut -o -f x,a,i $indir/multi-sep.dkvp run_mlr --oxtab --no-mmap --irs crlf --ifs , --ips = cut -o -f x,a,i $indir/multi-sep.dkvp run_mlr --oxtab --no-mmap --irs crlf --ifs /, --ips =: cut -o -f x,a,i $indir/multi-sep.dkvp # ---------------------------------------------------------------- announce MULTI-CHARACTER IRS/IFS FOR NIDX run_mlr --oxtab --inidx --mmap --irs lf --ifs , cut -o -f 4,1,3 $indir/multi-sep.dkvp run_mlr --oxtab --inidx --mmap --irs lf --ifs /, cut -o -f 4,1,3 $indir/multi-sep.dkvp run_mlr --oxtab --inidx --mmap --irs crlf --ifs , cut -o -f 4,1,3 $indir/multi-sep.dkvp run_mlr --oxtab --inidx --mmap --irs crlf --ifs /, cut -o -f 4,1,3 $indir/multi-sep.dkvp run_mlr --oxtab --inidx --no-mmap --irs lf --ifs , cut -o -f 4,1,3 $indir/multi-sep.dkvp run_mlr --oxtab --inidx --no-mmap --irs lf --ifs /, cut -o -f 4,1,3 $indir/multi-sep.dkvp run_mlr --oxtab --inidx --no-mmap --irs crlf --ifs , cut -o -f 4,1,3 $indir/multi-sep.dkvp run_mlr --oxtab --inidx --no-mmap --irs crlf --ifs /, cut -o -f 4,1,3 $indir/multi-sep.dkvp # ---------------------------------------------------------------- announce MULTI-CHARACTER IRS/IFS FOR CSVLITE run_mlr --oxtab --icsvlite --mmap --irs lf --ifs , cut -o -f x/,a/,i/ $indir/multi-sep.csv run_mlr --oxtab --icsvlite --mmap --irs lf --ifs /, cut -o -f x,a,i $indir/multi-sep.csv run_mlr --oxtab --icsvlite --mmap --irs crlf --ifs , cut -o -f x/,a/,i/ $indir/multi-sep.csv run_mlr --oxtab --icsvlite --mmap --irs crlf --ifs /, cut -o -f x,a,i $indir/multi-sep.csv run_mlr --oxtab --icsvlite --no-mmap --irs lf --ifs , cut -o -f x/,a/,i/ $indir/multi-sep.csv run_mlr --oxtab --icsvlite --no-mmap --irs lf --ifs /, cut -o -f x,a,i $indir/multi-sep.csv run_mlr --oxtab --icsvlite --no-mmap --irs crlf --ifs , cut -o -f x/,a/,i/ $indir/multi-sep.csv run_mlr --oxtab --icsvlite --no-mmap --irs crlf --ifs /, cut -o -f x,a,i $indir/multi-sep.csv # ---------------------------------------------------------------- announce MULTI-CHARACTER SEPARATORS FOR XTAB run_mlr --mmap --xtab --ifs crlf --ofs Z cut -x -f b $indir/truncated.xtab-crlf run_mlr --no-mmap --xtab --ifs crlf --ofs Z cut -x -f b $indir/truncated.xtab-crlf run_mlr --mmap --xtab --ips . --ops @ cut -x -f b $indir/dots.xtab run_mlr --no-mmap --xtab --ips . --ops @ cut -x -f b $indir/dots.xtab run_mlr --no-mmap --xtab --ips . --ops := cut -x -f b $indir/dots.xtab run_mlr --xtab --ips ": " --ops '@@@@' put '$sum=int($a+$b)' $indir/multi-ips.dkvp # ---------------------------------------------------------------- announce MULTI-CHARACTER IRS FOR PPRINT run_mlr --mmap --pprint --irs crlf --ifs / --ofs @ cut -x -f b $indir/dots.pprint run_mlr --no-mmap --pprint --irs crlf --ifs / --ofs @ cut -x -f b $indir/dots.pprint # ---------------------------------------------------------------- announce BARRED PPRINT run_mlr --opprint --barred cat $indir/abixy run_mlr --opprint --barred --right cat $indir/abixy run_mlr --opprint --barred cat $indir/abixy-het run_mlr --opprint --barred --right cat $indir/abixy-het # ---------------------------------------------------------------- announce MULTI-CHARACTER IXS SPECIFIERS run_mlr --oxtab --idkvp --mmap --irs lf --ifs '\x2c' --ips '\075' cut -o -f x,a,i $indir/multi-sep.dkvp run_mlr --oxtab --idkvp --mmap --irs lf --ifs /, --ips '\x3d\x3a' cut -o -f x,a,i $indir/multi-sep.dkvp # ---------------------------------------------------------------- announce JSON I/O run_mlr --ijson --opprint cat $indir/small-non-nested.json run_mlr --ijson --opprint cat $indir/small-non-nested-wrapped.json run_mlr --ijson --oxtab cat $indir/small-nested.json run_mlr --ojson cat $indir/json-output-options.dkvp run_mlr --ojson --jvstack cat $indir/json-output-options.dkvp run_mlr --ojson --jlistwrap cat $indir/json-output-options.dkvp run_mlr --ojson --jvstack --jlistwrap cat $indir/json-output-options.dkvp run_mlr --ojson --jquoteall cat $indir/json-output-options.dkvp run_mlr --ojson --jvstack --jquoteall cat $indir/json-output-options.dkvp run_mlr --ojson --jlistwrap --jquoteall cat $indir/json-output-options.dkvp run_mlr --ojson --jvstack --jlistwrap --jquoteall cat $indir/json-output-options.dkvp run_mlr --ijson --opprint cat $indir/small-non-nested-wrapped.json $indir/small-non-nested-wrapped.json run_mlr --no-mmap --ijson --opprint cat $indir/small-non-nested-wrapped.json $indir/small-non-nested-wrapped.json # ---------------------------------------------------------------- announce FORMAT-CONVERSION KEYSTROKE-SAVERS run_mlr --d2t cat $indir/abixy.dkvp run_mlr --d2n cat $indir/abixy.dkvp run_mlr --d2j cat $indir/abixy.dkvp run_mlr --d2p cat $indir/abixy.dkvp run_mlr --d2x cat $indir/abixy.dkvp run_mlr --d2m cat $indir/abixy.dkvp run_mlr --c2t cat $indir/abixy.csv run_mlr --c2d cat $indir/abixy.csv run_mlr --c2n cat $indir/abixy.csv run_mlr --c2j cat $indir/abixy.csv run_mlr --c2p cat $indir/abixy.csv run_mlr --c2x cat $indir/abixy.csv run_mlr --c2m cat $indir/abixy.csv run_mlr --t2c cat $indir/abixy.tsv run_mlr --t2d cat $indir/abixy.tsv run_mlr --t2n cat $indir/abixy.tsv run_mlr --t2j cat $indir/abixy.tsv run_mlr --t2p cat $indir/abixy.tsv run_mlr --t2x cat $indir/abixy.tsv run_mlr --t2m cat $indir/abixy.tsv run_mlr --n2c cat $indir/abixy.nidx run_mlr --n2t cat $indir/abixy.nidx run_mlr --n2d cat $indir/abixy.nidx run_mlr --n2j cat $indir/abixy.nidx run_mlr --n2p cat $indir/abixy.nidx run_mlr --n2x cat $indir/abixy.nidx run_mlr --n2m cat $indir/abixy.nidx run_mlr --j2c cat $indir/abixy.json run_mlr --j2t cat $indir/abixy.json run_mlr --j2d cat $indir/abixy.json run_mlr --j2n cat $indir/abixy.json run_mlr --j2p cat $indir/abixy.json run_mlr --j2x cat $indir/abixy.json run_mlr --j2m cat $indir/abixy.json run_mlr --p2c cat $indir/abixy.pprint run_mlr --p2t cat $indir/abixy.pprint run_mlr --p2d cat $indir/abixy.pprint run_mlr --p2n cat $indir/abixy.pprint run_mlr --p2j cat $indir/abixy.pprint run_mlr --p2x cat $indir/abixy.pprint run_mlr --p2m cat $indir/abixy.pprint run_mlr --x2c cat $indir/abixy.xtab run_mlr --x2t cat $indir/abixy.xtab run_mlr --x2d cat $indir/abixy.xtab run_mlr --x2n cat $indir/abixy.xtab run_mlr --x2j cat $indir/abixy.xtab run_mlr --x2p cat $indir/abixy.xtab run_mlr --x2m cat $indir/abixy.xtab # ---------------------------------------------------------------- announce USER-DEFINED FUNCTIONS AND SUBROUTINES run_mlr --opprint --from $indir/abixy put 'func f(u,v){return u+v} $o=f(NR*1000,$x)' mlr_expect_fail --opprint --from $indir/abixy put 'func f(x,y,z){$nnn=999; int n=10; return $y} $o=f($i,$x,$y)' run_mlr --opprint --from $indir/abixy put 'subr s(a,b) { $[a] = b } call s("W", 999)' run_mlr --opprint --from $indir/abixy put ' func f(x,y,z) { return x + y + z } subr s(a,b) { $[a] = b; $DID = "YES"; } $o = f($x, $y, $i); call s("W", NR); ' run_mlr --opprint --from $indir/abixy put ' func f(x,y,z) { return x + y + z } subr s(a,b) { $[a] = b; return; $DID = "YES"; } $o = f($x, $y, $i); call s("W", NR); ' mlr_expect_fail --from $indir/abixy put ' func f(x,y,z) { return x + y + z } subr s(a,b) { $[a] = b; return 1 # subr must not return value } $o = f($x, $y, $i); call s("W", NR); ' mlr_expect_fail --from $indir/abixy put ' func f(x,y,z) { return # func must return value } subr s(a,b) { $[a] = b; } $o = f($x, $y, $i); call s("W", NR); ' # Test fencing: function f should not have access to boundvar k from the callsite. run_mlr --from $indir/abixy --opprint put 'func f(x) {return k} for (k,v in $*) {$o=f($x)}' run_mlr --from $indir/abixy --opprint put 'subr foo() {print "k is [".k."]"} for (k,v in $*) {call foo()}' # Test overriding built-ins mlr_expect_fail --opprint --from $indir/abixy put 'func log(x) { return 0 } $o = log($x)' run_mlr --from $indir/abixy put 'subr log() { print "hello record ". NR } call log()' # Test variable-clear at scope exit; test read of unset locals. run_mlr --opprint --from $indir/abixy put '$o1 = a; int a=1000+NR; $o2 = a; a=2000+NR; $o3 = a' # Test recursion run_mlr --opprint --from $indir/abixy put ' func f(n) { if (isnumeric(n)) { if (n > 0) { return n * f(n-1) } else { return 1 } } # implicitly return absent } $o = f(NR) ' run_mlr --opprint --from $indir/abixy head -n 5 then put ' subr s(n) { print "n = " . n; if (isnumeric(n)) { if (n > 0) { call s(n-1) } } } print ""; call s(NR) ' run_mlr --from $indir/abixy --opprint put ' func f(n) { return n+1; } $o1 = f(NR); $o2 = f(f(NR)); $o3 = f(f(f(NR))); $o4 = f(f(f(f(NR)))); $o5 = f(f(f(f(f(NR))))); $o6 = f(f(f(f(f(f(NR)))))); ' run_mlr --from $indir/abixy --opprint put ' func f(n) { if (n < 2) { return 1 } else { return f(n-1) + f(n-2) } } $o = f(NR) ' run_mlr --from $indir/abixy --opprint put ' func f(n) { if (ispresent(@fcache[n])) { return @fcache[n] } else { num rv = 1; if (n >= 2) { rv = f(n-1) + f(n-2) } @fcache[n] = rv; return rv } } $o = f(NR) ' # No nesting of top-levels mlr_expect_fail --from $indir/abixy --opprint put 'func f(x) { begin {} }' mlr_expect_fail --from $indir/abixy --opprint put 'func f(x) { end {} }' mlr_expect_fail --from $indir/abixy --opprint put 'subr s(x) { begin {} }' mlr_expect_fail --from $indir/abixy --opprint put 'subr s(x) { end {} }' mlr_expect_fail --from $indir/abixy --opprint put 'func f(x) { func g(y) {} }' mlr_expect_fail --from $indir/abixy --opprint put 'func f(x) { subr t(y) {} }' mlr_expect_fail --from $indir/abixy --opprint put 'subr s(x) { func g(y) {} }' mlr_expect_fail --from $indir/abixy --opprint put 'subr s(x) { subr t(y) {} }' mlr_expect_fail --from $indir/abixy --opprint filter 'func f(x) { begin {} }; true' mlr_expect_fail --from $indir/abixy --opprint filter 'func f(x) { end {} }; true' mlr_expect_fail --from $indir/abixy --opprint filter 'subr s(x) { begin {} }; true' mlr_expect_fail --from $indir/abixy --opprint filter 'subr s(x) { end {} }; true' mlr_expect_fail --from $indir/abixy --opprint filter 'func f(x) { func g(y) {} }; true' mlr_expect_fail --from $indir/abixy --opprint filter 'func f(x) { subr t(y) {} }; true' mlr_expect_fail --from $indir/abixy --opprint filter 'subr s(x) { func g(y) {} }; true' mlr_expect_fail --from $indir/abixy --opprint filter 'subr s(x) { subr t(y) {} }; true' # Disallow redefines mlr_expect_fail --from $indir/abixy --opprint put 'func log(x) { return $x + 1 }' mlr_expect_fail --from $indir/abixy --opprint put 'func f(x) { return $x + 1 } func f(x) { return $x + 1}' mlr_expect_fail --from $indir/abixy --opprint put 'subr s() { } subr s() { }' mlr_expect_fail --from $indir/abixy --opprint put 'subr s() { } subr s(x) { }' run_mlr --from $indir/abixy --opprint put 'subr log(text) { print "TEXT IS ".text } call log("NR is ".NR)' # print/dump from subr/func; no tee/emit from func run_mlr --from $indir/abixy --opprint put 'subr log(text) { print "TEXT IS ".text } call log("NR is ".NR)' run_mlr --from $indir/abixy --opprint put 'func f(text) { print "TEXT IS ".text; return text.text } $o = f($a)' run_mlr --from $indir/abixy put 'begin{@x=1} func f(x) { dump; print "hello" } $o=f($i)' mlr_expect_fail --from $indir/abixy put 'begin{@x=1} func f(x) { dump; print "hello"; tee > "x", $* } $o=f($i)' mlr_expect_fail --from $indir/abixy put 'begin{@x=1} func f(x) { dump; print "hello"; emit > "x", @* } $o=f($i)' # not use all args (for valgrind) run_mlr --from $indir/abixy put 'func f(x,y) { return 2*y } $o = f($x,$y) ' # general programming-language stuff run_mlr -n put -q -f $indir/sieve.mlr run_mlr -n put -q -f $indir/mand.mlr # scoping within distinct begin/end blocks run_mlr --from $indir/abixy put -v ' func f(x) { return x**2 } func g(y) { return y+1 } subr s(a,b,c) { print a.b.c } begin { @a = 0; var ell = 1; print "local1 = ".ell; } end { emit @a; var emm = 2; print "local2 = ".emm; } @a += 1; begin { @b = 0; @c = 0; print "local3 = ".ell; } @b += 2; @c += 3; end { emit @b; emit @c; print "local4 = ".emm; } ' # ---------------------------------------------------------------- announce LOCALVAR SCOPE AND EXTENT run_mlr --opprint --from $indir/abixy put ' func f() { var a = 1; if (NR > 5) { a = 2; } return a; } func g() { var b = 1; if (NR > 5) { var b = 2; } return b; } func h() { var a = 1; if (NR > 5) { a = 2; return a; } return a; } func i() { var b = 1; if (NR > 5) { var b = 2; return b; } return b; } $of = f(); $og = g(); $oh = h(); $oi = i(); ' # test fencing at function entry run_mlr --opprint --from $indir/abixy put ' func f() { var a = 2; var b = 2; if (NR > 5) { var a = 3; b = 3; } return 1000 * a + b; } a = 1; b = 1; $ab = f(); $oa = a; $ob = b; ' # ---------------------------------------------------------------- announce LOCAL MAP-VARIABLE WRITE/READ run_mlr --from $indir/xyz345 put -v -a ' $s = a; $t = b[$x]; $u = c[$x][$y]; $v = d[$x][$y][$z]; ' run_mlr --from $indir/xyz345 put -v -a ' d[$x][$y][$z] = 9; $d = d[$x][$y][$z]; ' run_mlr --from $indir/xyz345 put -v -a ' a = 6; b[$x] = 7; c[$x][$y] = 8; d[$x][$y][$z] = 9; $a = a; $b = b[$x]; $c = c[$x][$y]; $d = d[$x][$y][$z]; ' run_mlr --from $indir/xyz345 put -v -a ' a = 6; b[$x] = 7; c[$x][$y] = 8; d[$x][$y][$z] = 9; $a0 = a; $a1 = a[$x]; $a2 = a[$x][$y]; $a3 = a[$x][$y][$z]; $b0 = b; $b1 = b[$x]; $b2 = b[$x][$y]; $b3 = b[$x][$y][$z]; $c0 = c; $c1 = c[$x]; $c2 = c[$x][$y]; $c3 = c[$x][$y][$z]; $d0 = d; $d1 = d[$x]; $d2 = d[$x][$y]; $d3 = d[$x][$y][$z]; ' # ---------------------------------------------------------------- announce LOCAL MAP-VARIABLE TYPE-DECL run_mlr --from $indir/xyz345 put ' map a = {}; ' run_mlr --from $indir/xyz345 put ' map a = {}; a[1]=2; a[3][4]=5; ' mlr_expect_fail --from $indir/xyz345 put ' map a = {}; a=2; a[3][4]=5; ' mlr_expect_fail --from $indir/xyz345 put ' map a = {}; a[3][4]=5; a=2; ' # ---------------------------------------------------------------- announce TRIPLE-FORs run_mlr --opprint --from $indir/abixy put ' num sum = 0; num a = 1; for (;;) { if (a > NR) { break; } sum += a; a += 1 } $z = sum ' run_mlr --opprint --from $indir/abixy put ' num sum = 0; num a = 1; for (;;) { if (a > NR) { break; } sum += a; a += 1 } $z = sum ' run_mlr --opprint --from $indir/abixy put ' num sum = 0; for (num a = 1; ;) { if (a > NR) { break; } sum += a; a += 1 } $z = sum ' run_mlr --opprint --from $indir/abixy put ' num sum = 0; num a = 1; for (; ; a += 1) { if (a > NR) { break; } sum += a; } $z = sum ' run_mlr --opprint --from $indir/abixy put ' num sum = 0; for (num a=1; ; a += 1) { if (a > NR) { break; } sum += a; } $z = sum ' run_mlr --opprint --from $indir/abixy put ' num sum = 0; for (num a=1; a <= NR; a += 1) { sum += a; } $z = sum ' echo x=1 | run_mlr put ' num a = 100; num b = 100; for (num a = 200, b = 300; a <= 210; a += 1, b += 1) { print "a:".a.",b:".b } $oa = a; $ob = b; ' run_mlr --from $indir/abixy put ' for ( ; $x <= 10; $x += 1) { } ' run_mlr --opprint --from $indir/abixy put ' num a = 100; b = 200; @c = 300; $d = 400; for (num i = 1; i < 1024; i *= 2) { a += 1; b += 1; @c += 1; $d += 1; $oa = a; $ob = b; $oc = @c; $od = $d; } ' run_mlr --opprint --from $indir/abixy put ' num sum = 0; for (num a = 1; a <= 10; a += 1) { continue; sum += a; } $z = sum ' run_mlr --opprint --from $indir/abixy put ' num sum = 0; for (num a = 1; a <= 10; a += 1) { sum += a; break; } $z = sum ' run_mlr --opprint --from $indir/abixy put ' num sum = 0; for (num a = 1; a <= NR; a += 1) { if (a == 4 || a == 5) { continue; } if (a == 8) { break; } sum += a; } $z = sum ' # Multi-continutation cases run_mlr --opprint --from $indir/abixy put ' for ($o1 = 1; ; $o3 = 3) { break; } ' run_mlr --opprint --from $indir/abixy put ' for ($o1 = 1; $o1 < NR; $o1 += 1) { } ' mlr_expect_fail --opprint --from $indir/abixy put ' for ($o1 = 1, $o2 = 2; $o3 = 3; $o4 = 4) { } ' mlr_expect_fail --opprint --from $indir/abixy put ' for ($o1 = 1, $o2 = 2; $o3 < 3, $o4 = 4; $o5 = 5) { break; } ' run_mlr --opprint --from $indir/abixy put ' $o4 = 0; for ($o1 = 1, $o2 = 2; $o3 = 3, $o4 < 4; $o5 = 5) { break; } ' # ---------------------------------------------------------------- announce MAPVAR ASSIGNMENTS TO FULL SREC run_mlr --from $indir/xyz2 put '$* = {"a":1, "b": {"x":8,"y":9}, "c":3}' run_mlr --from $indir/xyz2 put '$* = $*' run_mlr --from $indir/xyz2 put '@a = 1; $* = @a' run_mlr --from $indir/xyz2 put '@b[1] = 2; $* = @b' run_mlr --from $indir/xyz2 put '@c[1][2] = 3; $* = @c' run_mlr --from $indir/xyz2 put '@a = 1; $* = @*' run_mlr --from $indir/xyz2 put '@b[1] = 2; $* = @*' run_mlr --from $indir/xyz2 put '@c[1][2] = 3; $* = @*' run_mlr --from $indir/xyz2 put 'a = 1; $* = a' run_mlr --from $indir/xyz2 put 'b[1] = 2; $* = b' run_mlr --from $indir/xyz2 put 'c[1][2] = 3; $* = c' # xxx not yet # run_mlr --from $indir/xyz2 put 'func map_valued_func() { return {"a":1,"b":2}} $* = map_valued_func(); dump a' # ---------------------------------------------------------------- announce MAPVAR ASSIGNMENTS TO FULL OOSVAR # xxx not yet #run_mlr --from $indir/xyz2 put '@* = {"a":1, "b": {"x":8,"y":9}, "c":3}; dump' #run_mlr --from $indir/xyz2 put '@* = @*; dump' #run_mlr --from $indir/xyz2 put '@a = 1; @* = @a; dump' #run_mlr --from $indir/xyz2 put '@b[1] = 2; @* = @b; dump' #run_mlr --from $indir/xyz2 put '@c[1][2] = 3; @* = @c; dump' #run_mlr --from $indir/xyz2 put '@a = 1; @* = @*; dump' #run_mlr --from $indir/xyz2 put '@b[1] = 2; @* = @*; dump' #run_mlr --from $indir/xyz2 put '@c[1][2] = 3; @* = @*; dump' #run_mlr --from $indir/xyz2 put 'a = 1; @* = a; dump' #run_mlr --from $indir/xyz2 put 'b[1] = 2; @* = b; dump' #run_mlr --from $indir/xyz2 put 'c[1][2] = 3; @* = c; dump' ## xxx not yet ## run_mlr --from $indir/xyz2 put 'func map_valued_func() { return {"a":1,"b":2}} @* = map_valued_func(); dump a; dump' # ---------------------------------------------------------------- announce MAPVAR ASSIGNMENTS TO OOSVAR run_mlr --from $indir/xyz2 put -q '@o = {"a":1, "b": {"x":8,"y":9}, "c":3}; dump @o' run_mlr --from $indir/xyz2 put -q '@o = @o; dump @o' run_mlr --from $indir/xyz2 put -q '@o = {"a":1, "b": {"x":8,"y":9}, "c":3}; @o = @o; dump @o' run_mlr --from $indir/xyz2 put -q '@a = 1; @o = @a; dump @o' run_mlr --from $indir/xyz2 put -q '@b[1] = 2; @o = @b; dump @o' run_mlr --from $indir/xyz2 put -q '@c[1][2] = 3; @o = @c; dump @o' # xxx not yet: run_mlr --from $indir/xyz2 put -q '@a = 1; @o = @*; dump @o' # xxx not yet: run_mlr --from $indir/xyz2 put -q '@b[1] = 2; @o = @*; dump @o' # xxx not yet: run_mlr --from $indir/xyz2 put -q '@c[1][2] = 3; @o = @*; dump @o' run_mlr --from $indir/xyz2 put -q 'a = 1; @o = a; dump @o' run_mlr --from $indir/xyz2 put -q 'b[1] = 2; @o = b; dump @o' run_mlr --from $indir/xyz2 put -q 'c[1][2] = 3; @o = c; dump @o' # xxx not yet # run_mlr --from $indir/xyz2 put -q 'func map_valued_func() { return {"a":1,"b":2}} @o = map_valued_func(); dump @o' # ---------------------------------------------------------------- announce MAPVAR ASSIGNMENTS TO MAP-TYPED LOCAL run_mlr --from $indir/xyz2 put -q 'map o = {"a":1, "b": {"x":8,"y":9}, "c":3}; dump o' mlr_expect_fail --from $indir/xyz2 put -q 'map o = @o; dump o' run_mlr --from $indir/xyz2 put -q 'map o = {"a":1, "b": {"x":8,"y":9}, "c":3}; o = o; dump o' mlr_expect_fail --from $indir/xyz2 put -q '@a = 1; map o = @a; dump o' run_mlr --from $indir/xyz2 put -q '@b[1] = 2; map o = @b; dump o' run_mlr --from $indir/xyz2 put -q '@c[1][2] = 3; map o = @c; dump o' # xxx not yet: run_mlr --from $indir/xyz2 put -q '@a = 1; map o = @*; dump o' # xxx not yet: run_mlr --from $indir/xyz2 put -q '@b[1] = 2; map o = @*; dump o' # xxx not yet: run_mlr --from $indir/xyz2 put -q '@c[1][2] = 3; map o = @*; dump o' mlr_expect_fail --from $indir/xyz2 put -q 'a = 1; map o = a; dump o' run_mlr --from $indir/xyz2 put -q 'b[1] = 2; map o = b; dump o' run_mlr --from $indir/xyz2 put -q 'c[1][2] = 3; map o = c; dump o' # xxx not yet # run_mlr --from $indir/xyz2 put -q 'func map_valued_func() { return {"a":1,"b":2}} map o = map_valued_func(); dump o' # ---------------------------------------------------------------- announce MAPVAR ASSIGNMENTS TO VAR-TYPED LOCAL run_mlr --from $indir/xyz2 put -q 'var o = {"a":1, "b": {"x":8,"y":9}, "c":3}; dump o' run_mlr --from $indir/xyz2 put -q 'var o = @o; dump o' run_mlr --from $indir/xyz2 put -q 'var o = {"a":1, "b": {"x":8,"y":9}, "c":3}; o = o; dump o' run_mlr --from $indir/xyz2 put -q '@a = 1; var o = @a; dump o' run_mlr --from $indir/xyz2 put -q '@b[1] = 2; var o = @b; dump o' run_mlr --from $indir/xyz2 put -q '@c[1][2] = 3; var o = @c; dump o' # xxx not yet: run_mlr --from $indir/xyz2 put -q '@a = 1; var o = @*; dump o' # xxx not yet: run_mlr --from $indir/xyz2 put -q '@b[1] = 2; var o = @*; dump o' # xxx not yet: run_mlr --from $indir/xyz2 put -q '@c[1][2] = 3; var o = @*; dump o' run_mlr --from $indir/xyz2 put -q 'a = 1; var o = a; dump o' run_mlr --from $indir/xyz2 put -q 'b[1] = 2; var o = b; dump o' run_mlr --from $indir/xyz2 put -q 'c[1][2] = 3; var o = c; dump o' # xxx not yet # run_mlr --from xyz2 put -q 'func map_valued_func() { return {"a":1,"b":2}} var o = map_valued_func(); dump o' # ---------------------------------------------------------------- announce MAPVAR ASSIGNMENTS TO UNTYPED LOCAL run_mlr --from $indir/xyz2 put -q 'o = {"a":1, "b": {"x":8,"y":9}, "c":3}; dump o' run_mlr --from $indir/xyz2 put -q 'o = @o; dump o' run_mlr --from $indir/xyz2 put -q 'o = {"a":1, "b": {"x":8,"y":9}, "c":3}; o = o; dump o' run_mlr --from $indir/xyz2 put -q '@a = 1; o = @a; dump o' run_mlr --from $indir/xyz2 put -q '@b[1] = 2; o = @b; dump o' run_mlr --from $indir/xyz2 put -q '@c[1][2] = 3; o = @c; dump o' # xxx not yet: run_mlr --from $indir/xyz2 put -q '@a = 1; o = @*; dump o' # xxx not yet: run_mlr --from $indir/xyz2 put -q '@b[1] = 2; o = @*; dump o' # xxx not yet: run_mlr --from $indir/xyz2 put -q '@c[1][2] = 3; o = @*; dump o' run_mlr --from $indir/xyz2 put -q 'a = 1; o = a; dump o' run_mlr --from $indir/xyz2 put -q 'b[1] = 2; o = b; dump o' run_mlr --from $indir/xyz2 put -q 'c[1][2] = 3; o = c; dump o' # xxx not yet # run_mlr --from xyz2 put -q 'func map_valued_func() { return {"a":1,"b":2}} o = map_valued_func(); dump o' run_mlr -n put 'end { @a[2][3] = 4; b[2][3] = 8; emitp (@a, b, {2:{3:12}}); # xxx crash on orderswap emit (@a, b, {2:{3:12}}); emit {}; emit (@a, b, {2:{3:12}}), "t"; emitp (@a, b, {2:{3:12}}), "t"; emit {}; emit (@a, b, {2:{3:12}}), "t", "u"; emitp (@a, b, {2:{3:12}}), "t", "u"; }' # ######################################################## def4a # subr s(a,b) { # $[a] = b; # $DID = "YES"; # } # # ######################################################## def4b # func f(x,y,z) { # return x + y + z # } # # ######################################################## def4c # $o = f($x, $y, $i); # call s("W", NR); # # ================================================================ # A key feature of this regression script is that it can be invoked from any # directory. Depending on the directory it's invoked from, the path to $outdir # may vary. Nonetheless for debugging it's crucial that we echo out each # command being executed -- here we use diff -I to skip the info lines and # focus the test on program output per se. echo echo ================================================================ echo "Differences between $expfile and $outfile:" diff -I '^mlr ' -C5 $expfile $outfile echo "No differences found between $expfile and $outfile" # since set -e echo ================================================================ echo # ================================================================ echo ALL REGRESSION TESTS PASSED echo Tests completed: $num_passed