OLD_IFS="$IFS" IFS="," arr=(`cat a.txt`) IFS="$OLD_IFS" for s in ${arr[@]} do echo $s | tr -d '"' done
将逗号分隔的字符串放到 a.txt文件,中格式:ss,21,ss,
输出格式:
ss
21
xx
OLD_IFS="$IFS" IFS="," arr=(`cat a.txt`) IFS="$OLD_IFS" for s in ${arr[@]} do echo $s | tr -d '"' done
将逗号分隔的字符串放到 a.txt文件,中格式:ss,21,ss,
输出格式:
ss
21
xx