If you have a text file and want to search and replace a part of a matched pattern, how would you do it with perl one-liners, sed or python?
For example:
"653433,78"
match with [0-9]{6},[0-9]{2}
.
Change ,
to .
.
regex
If you have a text file and want to search and replace a part of a matched pattern, how would you do it with perl one-liners, sed or python?
For example:
"653433,78"
match with [0-9]{6},[0-9]{2}
.
Change ,
to .
.
Best Answer
You can use numbered sub groups. i.e:
Find:
Replace:
Example in Python:
This would give you: