Problem: In linux I want to find a string and replace it with other string in a file.
Solution: Use the below command.
The above command will recursively searches for all the files in current working directory and it replaces all the occurrences of abc with 123 in the found files.
Solution: Use the below command.
find . -type f -print | xargs sed -i 's/abc/123/g'
The above command will recursively searches for all the files in current working directory and it replaces all the occurrences of abc with 123 in the found files.
No comments:
Post a Comment