在bash中将每一行指定为一个新变量

时间:2018-06-10 21:43:35

标签: bash variables awk

我有一个bash脚本,它给出了以下输出:

'string1': {'something': u'2.000', 'anotherthing': u'3.0000000'
'string2': {'something': u'1.000', 'anotherthing': u'1.85695664'
'string3': {'something': u'1.000', 'anotherthing': u'4.0000000'
'string4': {'something': '01.000', 'anotherthing': u'0.43448059'

我想为每一行指定一个变量(strinx)....我试过awk' {print" var" NR" =" $ 0}& #39; ,但它只是创建一个这样的变量:

var1=string1': {'something': u'2.000', 'anotherthing': u'3.0000000'
var2='string2': {'something': u'1.000', 'anotherthing': u'1.85695664'
var3='string3': {'something': u'1.000', 'anotherthing': u'4.0000000'
var4='string4': {'something': '01.000', 'anotherthing': u'0.43448059'.

如何获得超过1个变量?谢谢

0 个答案:

没有答案