如何从输入文件
导入/替换(sed)这些值cellIdentity="461"
cellIdentity="465"
cellIdentity="468"
cellIdentity="462"
cellIdentity="466"
cellIdentity="469"
cellIdentity="463"
cellIdentity="467"
cellIdentity="460"
。并按顺序将它们放到这个文件中,替换下面文件中的cellIdentity:
sectorNumber="1"
>
<Cell
cellNumber="1"
cellCreated="YES"
cellIdentity="461"
cellRange="35000"
baseBandPoolId="2"
numberOfTxBranches="1"
numberOfRxBranches="2"
/>
<Cell
cellNumber="2"
cellCreated="YES"
cellIdentity="465"
cellRange="35000"
baseBandPoolId="2"
numberOfTxBranches="1"
numberOfRxBranches="2"
/>
<Cell
cellNumber="3"
cellCreated="YES"
cellIdentity="468"
cellRange="35000"
baseBandPoolId="1"
numberOfTxBranches="1"
numberOfRxBranches="2"
/>
</Sector>
<Sector
sectorNumber="2"
>
<Cell
cellNumber="1"
cellCreated="YES"
cellIdentity="462"
cellRange="35000"
baseBandPoolId="2"
numberOfTxBranches="1"
numberOfRxBranches="2"
/>
<Cell
cellNumber="2"
cellCreated="YES"
cellIdentity="466"
cellRange="35000"
baseBandPoolId="2"
numberOfTxBranches="1"
numberOfRxBranches="2"
/>
<Cell
cellNumber="3"
cellCreated="YES"
cellIdentity="469"
cellRange="35000"
baseBandPoolId="1"
numberOfTxBranches="1"
numberOfRxBranches="2"
/>
</Sector>
<Sector
sectorNumber="3"
>
<Cell
cellNumber="1"
cellCreated="YES"
cellIdentity="463"
cellRange="35000"
baseBandPoolId="2"
numberOfTxBranches="1"
numberOfRxBranches="2"
/>
<Cell
cellNumber="2"
cellCreated="YES"
cellIdentity="467"
cellRange="35000"
baseBandPoolId="2"
numberOfTxBranches="1"
numberOfRxBranches="2"
/>
<Cell
cellNumber="3"
cellCreated="YES"
cellIdentity="460"
cellRange="35000"
baseBandPoolId="1"
numberOfTxBranches="1"
numberOfRxBranches="2"
/>
</Sector>
我是这个程序的新手,所以任何帮助都很合适。 我用/ bin / csh。 谢谢你的帮助
答案 0 :(得分:0)
他们已经看好了我。但我猜你想做这样的事情:
awk 'NR==FNR{a[NR]=$(NF-1);next}/cellIdentity/{$(NF-1)=a[++i]}1' FS='"' OFS='"' inputFile bigFile
答案 1 :(得分:0)
使用awk(您的输入文件格式正确,可以直接替换匹配行)
awk 'NR==FNR{a[FNR]=$0;next}/cellIdentity/{$0=a[++i]}1' input largefile