简体   繁体   中英

Convert reg-ex across all files in folder

I am a novice with reg-ex and would like to know how to convert the following in every c file in a folder.

#Before
TEST_RESULTS *setAll = FIXED(TEST_VALUES_ONE);

#After
TEST_RESULTS *setAll = FIXED_SET(setAll, TEST_VALUES_ONE);

The only constant in this is FIXED , whereas the others are variables and will have different names throughout the files. One other thing some of the files with this expression cover two lines. Does that need to be different I guess? eg

TEST_RESULTS_TWO *setAllTwo =
            FIXED(TEST_VALUES_ONE));

Preferably carried out in python/perl

perl -pi.bak -e's/FIXED\(/FIXED_SET(setAll, /g' <files>

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM