我有一个文件,其中包含:(冒号)作为熟食表,如下所示,该文件中包含一些以 ## 开头的注释
##No sync
no_sync:start:Async:SingleChainSdo:end:tile_dfx.sdc_ch_pcie_bot_lft_STAC.I_JTAG1500BC_SWB_0.I_SWB_Shift.I_ShTDR[0].Qreg:IP_WRCK
yes_sync:start:Async:SingleChainSdo:end:tile_dfx.sdc_ch_pcie_bot_lft_STAC.I_stac_pipeline_Wso.I_PIPELINE_POSEDGE.Qreg:IP_WRCK
##TDR will be static during functional operation
Rev:start:MTAP_Wrck:tile_dfx.dft_clk_cntl_Cpl_SMNCLK.clk_cntl_tdr.reg_CLK_CNTL.DFT_TDRUPDATEREG.q[3:1]:end:tile_dfx.dft_clk_cntl_Cpl_SMNCLK.dft_gater_aon:SMNCLK
Note: In column $4 we have the value "tile_dfx.dft_clk_cntl_Cpl_SMNCLK.clk_cntl_tdr.reg_CLK_CNTL.DFT_TDRUPDATEREG.q[3:1]" where :(colon) is available here need to ignore colon in []..In some values column $5 also it will repeat
我试过这段代码:
#!/bin/bash
awk -F: '/^[^#]/ {print "adc report item -status waived -scheme" " "$1, "-from" " ""{"$4"}", "-to" " ""{"$6"}", "-tx_clock" " "$3, "-rx_clock" " "$7 }' vio.s
输出我得到的:
adc report item -status waived -scheme no_sync -from {SingleChainSdo} -to {tile_dfx.sdc_ch_pcie_bot_lft_STAC.I_JTAG1500BC_SWB_0.I_SWB_Shift.I_ShTDR[0].Qreg} -tx_clock Async -rx_clock IP_WRCK
adc report item -status waived -scheme yes_sync -from {SingleChainSdo} -to {tile_dfx.sdc_ch_pcie_bot_lft_STAC.I_stac_pipeline_Wso.I_PIPELINE_POSEDGE.Qreg} -tx_clock Async -rx_clock IP_WRCK
adc report item -status waived -scheme Rev -from {tile_dfx.dft_clk_cntl_Cpl_SMNCLK.clk_cntl_tdr.reg_CLK_CNTL.DFT_TDRUPDATEREG.q[3} -to {end} -tx_clock MTAP_Wrck -rx_clock tile_dfx.dft_clk_cntl_Cpl_SMNCLK.dft_gater_aon
实际输出:
adc report item -status waived -scheme no_sync -from {SingleChainSdo} -to {tile_dfx.sdc_ch_pcie_bot_lft_STAC.I_JTAG1500BC_SWB_0.I_SWB_Shift.I_ShTDR[0].Qreg} -tx_clock Async -rx_clock IP_WRCK
adc report item -status waived -scheme yes_sync -from {SingleChainSdo} -to {tile_dfx.sdc_ch_pcie_bot_lft_STAC.I_stac_pipeline_Wso.I_PIPELINE_POSEDGE.Qreg} -tx_clock Async -rx_clock IP_WRCK
adc report item -status waived -scheme Rev -from {tile_dfx.dft_clk_cntl_Cpl_SMNCLK.clk_cntl_tdr.reg_CLK_CNTL.DFT_TDRUPDATEREG.q[3:1]} -to {tile_dfx.dft_clk_cntl_Cpl_SMNCLK.dft_gater_aon} -tx_clock MTAP_Wrck -rx_clock SMNCLK
主要问题是如何忽略 [] 之间的 :(冒号) 分隔符