shell逐行读取替换

时间:2021-05-03 12:39:24   收藏:0   阅读:0

#!/bin/bash

while read line
do
echo $line
txt=`echo $line |awk -F‘ ‘ ‘{print $1}‘`
id=`echo $line|awk -F‘ ‘ ‘{print $3}‘`
echo $txt
echo $id
sed "s/ws22041.com/${txt}/g" 2.txt > 4.txt
sed "s/5429/${id}/g" 4.txt >> 5.txt

# sleep 5
done < 3.txt

评论(0
© 2014 mamicode.com 版权所有 京ICP备13008772号-2  联系我们:gaon5@hotmail.com
迷上了代码!