【发布时间】:2011-03-17 11:14:13
【问题描述】:
我想将第二列更改为大写,并且我只想在 shell 脚本中进行。 (没有人衬!)
#!/bin/sh
# read file line by line
file="/pdump/country.000000.txt"
while read line
do
mycol=`echo $line | awk -F"," '{print $2}'`
mycol_new=`echo $mycol | tr "[:lower:]" [:upper:]`
echo $line | awk -F"," '{print $1 "," $mycol_new "," $3 "," $4 "," $5 "," $6 "," $7 "," $8}'
done < $file
我无法将 $2 替换为 $mycol_new。 有什么建议吗?
【问题讨论】: