How to remove entire string that match specific pattern in unix txt file with a single command line
1
vote
4
answers
509
views
I would like to remove all the strings that contain "vcc".
Example:
s_regscan_ctrl_lab_2_regscan_ce s_regscan_data_l_regscan s_t_regscan_data_tieoff_regscan vcc_cram_viort1_6_t
vcc_cram_viort1_7_t vcc_cram_viort1_8_t vcc_cram_viort1_9_t vcc_cram_vioxio1_0_t
vcc_cram_vioxio1_1_t vcc_cram_vioxio1_2_t vcc_cram_vioxio2_0_t vcc_cram_vioxio2_1_t
vcc_cram_vioxio2_2_t vcchg vccl vssgnd m_b_regscan_data_tieoff_regscan
Expected output:
s_regscan_ctrl_lab_2_regscan_ce s_regscan_data_l_regscan s_t_regscan_data_tieoff_regscan vssgnd m_b_regscan_data_tieoff_regscan
I have tried with:
cat abc.txt | sed 's/\svcc.*\s//g'"
But it removed everything after vcc* and returned:
s_regscan_ctrl_lab_2_regscan_ce s_regscan_data_l_regscan s_t_regscan_data_tieoff_regscan
Can someone help?
Asked by bg yeoh Yeoh
(13 rep)
Oct 18, 2023, 11:29 AM
Last activity: Oct 19, 2023, 06:44 PM
Last activity: Oct 19, 2023, 06:44 PM