在输出文件中合并字符串

时间:2018-07-20 20:53:29

标签: arrays bash shell unix

我在两个文件中合并两个变量 这是我的文件的示例:

   cat  $ line 
    "Product ID";"Product Name";"Price";"Description"
    "310";"Ball;"30";"Some"

我的代码

while read line IFS=';' read pid pname price desc <<< $line
numn=0
If [ condition ]
((num++)
 output_filename=comb/"$(echo $pid| tr -d '"').json3"
else
fi 

此文件的结果为“ 310.json3”
我需要什么?

output_filename=comb/"$(echo $pid + ($num) | tr -d '"').json3"

Output= 310(1).json3

1 个答案:

答案 0 :(得分:0)

可以创建文件名

output_filename=$(printf "comb/%u(%u).json3" $pid $num)

如果这是您的主要问题。