I need to convert my bash script to OpenVMS, does any one know of an automatic converter or could help me manually ?
#!/bin/bash
#
# Convert input to .CNF
inputfile=$1
rm outfile;
for line in $(cat $inputfile | awk '{ print $1 }' | tr '\*' ' ' | grep 0041); do
if [ `cat $inputfile | grep ${line:0:11} | wc -l` -eq 100 ]; then
echo "?, ?, "${line:2:9}\* >> outfile;
elif [ `cat $inputfile | grep ${line:0:12} | wc -l` -eq 10 ]; then
echo "?, ?, "${line:2:10}\* >> outfile;
else
echo "?, ?, "${line:2} >> outfile;
fi;
#echo ${line:0:11};
done;
cat outfile | sort -u >> newoutfile;
The inputfile contains a list of numbers where I need to group them if there are 10 or 100 following numbers and otherwise print them normally. Example:
0041XYZ070690*
0041XYZ070691*
0041XYZ070692*
0041XYZ070693*
0041XYZ070694*
0041XYZ070695*
0041XYZ070696*
0041XYZ070697*
0041XYZ070698*
0041XYZ070699*
0041XYZ077778*
0041XYZ077949*
0041XYZ077950*
becomes:
?, ?, 0041XYZ07069*
?, ?, 0041XYZ077778
?, ?, 0041XYZ077949
?, ?, 0041XYZ077950