#!/bin/bash contains() { string="$1" substring="$2" if test "${string#*$substring}" != "$string" then return 0 # $substring is in $string else return 1 # $substring is not in $string fi } file=$1 dest=$2 rm $dest while IFS= read -r line do # display $line or do somthing with $line echo "$line" >> "$dest" contains "$line" ",ABC," && echo $line | sed -e "s/,ABC,/,ZRM,/g" >> "$dest" done <"$file"
Read write text file in shell
猜你喜欢
转载自kaqi.iteye.com/blog/2400426
今日推荐
周排行