when I run the perl oneliner with the input file all 3 lines are getting changed. what is the change should I need to make to change only first line. In other words how can I change the code to affect only if the word matches neglecting the rest of lines.
Others told you what you were missing: a \b. Here, I'll give you some other WTDI (while saving some keystrokes and the risk to type something the wrong way):
perl -pe "s/\.(mbh_succ_roam_i_vlr_e_plmn\b)/.new_$1/g" input.txt perl -pe "s/\.(?=mbh_succ_roam_i_vlr_e_plmn\b)/.new_/g" input.txt
In reply to Re: regex change should be applied in iputfile
by blazar
in thread regex change should be applied in iputfile
by Anonymous Monk
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |