字串取代,使用 awk & sed
str="1 2 3 4 5 6 7 8 9 10"
echo ${str} | awk ' { print $2 $4 $6 $8 $10 }; 'cat file | awk ' { print $2 $4 $6 $8 $10 }; 'str="1 2 3 4 5 6 7 8 9 10"
echo ${str} | awk ' { print $2 $1 $3 $4 $5 $6 $7 $8 $9 $10 };'echo 1M | sed 's/M/000K/'echo '1M and 2M' | sed 's/M/000K/g'sed -i -e "s/old/new/g" input.txtLast updated