Issue
For example:
input [TOTAL_CH-1:0] start_frame_i, // start of frame
Change to:
input [TOTAL_CH-1:0] i_start_frame, // start of frame
Add on to clarify: There are many different strings are like above.
Solution
GNU sed.
cat file.txt | sed -r 's/(\w+)_i\b/i_\1/g'
(\w+)_i\b
(\w+)_i
matches one or more word character ending with_i
and save the string before the_i
inside a capturing group(\w+)
.\b
word boundary to ensure it is the end of a word and not to match something likestart_frame_iAAA
which will result ini_start_frameAAA
i_\1
replace the matched string with, i_
at the beginning and \1
the value which we saved previously inside the capturing group.
Answered By - SaSkY Answer Checked By - Marilyn (WPSolving Volunteer)