i have another sed question.. I'm trying to do variable substition with sed and i'm running into a problem.
my var1 is a string constructed like this:
filename1 filerev1 filepath1
my var2 is another string constructed like this:
filename2 filerev2 filepath2
when i do sed "s/$var1/$var2/g" inputfile i get an errorstating that sed can't parse this correctly. I'm assuming its b/c the string variables contain (/) in the filepath portion... how can i get sed to treat the variable contents as a whole string without tripping up on the (/)? this string was constructed in a previous portion of my script using dirname, so trying to avoid going back and escaping each (/)... any suggestions?
thanks,
sed "s/99998/"$jobnum"/g;" $src"j99998a.pst" > "j"$jobnum"a.pst"
changes 99998 to my stored $jobnum
starting with my j99998a.pst file (using $src as path location)
and outputting to new name with my $jobnum as the new filename
Just follow all of the double quotes to make sure variables all line up correctly.
I actually do several of these when setting up repetitive work - copying a global use file and customizing it for my current job/task. (By habit, I use 99998 as a dummy number - I found that using 99999 could run into issues since "99999" could be a mask for outputs or other uses.)