How to replace a string in a file using Perl
How to replace a string in a file using Perl
Answer:
Assume you have a file "test'txt", contains the string "abc", and you want to replace by "def", use the following script
perl -pi -e "s/abc/def/g;" test.txt
Related posts:
- Search and replace string in file using Perl
- Replace a string using regular expressions in Perl
- Trim a string using Perl
- Replace Unicode character using regex with Perl
- Remove the last character of a string in Perl
Post a Comment