我需要将我的 bash 脚本转换为 OpenVMS,有人知道自动转换器还是可以手动帮助我?
#!/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;
输入文件包含一个数字列表,如果后面有 10 或 100 个数字,我需要将它们分组,否则正常打印它们。例子:
0041XYZ070690*
0041XYZ070691*
0041XYZ070692*
0041XYZ070693*
0041XYZ070694*
0041XYZ070695*
0041XYZ070696*
0041XYZ070697*
0041XYZ070698*
0041XYZ070699*
0041XYZ077778*
0041XYZ077949*
0041XYZ077950*
变成:
?, ?, 0041XYZ07069*
?, ?, 0041XYZ077778
?, ?, 0041XYZ077949
?, ?, 0041XYZ077950