因工作要批量写文件,需要写shell脚本,在此记录。
#!/bin/bash
cat runall|grep -E "ls|as" |while read line
do
echo $line
len=${#line}
echo $len
done
这里可以输出runall文件中包含ls或者as字符串的行,以及该行的字符串长度。
因工作要批量写文件,需要写shell脚本,在此记录。
#!/bin/bash
cat runall|grep -E "ls|as" |while read line
do
echo $line
len=${#line}
echo $len
done
这里可以输出runall文件中包含ls或者as字符串的行,以及该行的字符串长度。