sed -Replacing file path within .txt file

view full story

http://www.unix.com – Hi, I am trying to use sed to replace a file path within all the .lay (.txt) files in a folder. I feel that this should be easy but I can't get it to work no matter what i try. I'm using cygwin. For a .txt file containing the below line I want to replace this file path with a new one. $!VarSet |LFDSFN1| = '"E:\OLD\FILE\PATH TO DATA\data.txt" Below is what i think should work. old_file_path="E:\OLD\FILE\PATH TO DATA\data.txt" new_file_path="E:\new\file\path" sed -e 's|$old_file_path|$new_file_path|g' *.lay I've tried placing the variables inside the com (HowTos)