LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   Searching and replacing strings in a file with strings in other files (https://www.linuxquestions.org/questions/linux-newbie-8/searching-and-replacing-strings-in-a-file-with-strings-in-other-files-822893/)

xndd 07-29-2010 02:23 PM

Can you look at all the code pls. Because it gives same error again:
Code:

while read string1
do
find /path -type f -exec sed -i "s/${string1}|string2|/string2/g" '{}' \;
done < string1.txt

All i want to do is searching the path, and if the files contains the expression (expressions in string1.txt) then replace them with string2

Edit:

Oh silly me, just replaced this
Code:

find /path -type f -exec sed -i "s|${string1}|string2|" '{}'\;
and worked fine. Everybody thanx all :D

GrapefruiTgirl 07-29-2010 02:40 PM

Good work ;)


All times are GMT -5. The time now is 05:01 PM.