I'm pretty new to this, but think I have a decent grasp on it. However, amid a slew of different attempts, the solution to this particular combination is eluding me.
I have a bourn shell script which does some stuff, one of those stuffs to execute a sed command. It's giving me all sorts of trouble.
Here's the gist...
Now the output for this is
If I cut and paste the sed command, it runs perfectly.
I've tried many different combinations of the quotes, and escaping and it just doesn't seem to go well.
I went the route of not assigning it to a variable and just enclosing the string in backticks, that seemed to work fine, but the output file wasn't created.
Appreciate any help, thanks.
I have a bourn shell script which does some stuff, one of those stuffs to execute a sed command. It's giving me all sorts of trouble.
Here's the gist...
Code:
CMD = "sed -e 's/^${FIND}.*/${FIND}${1}/' ${INFILE} > ${OUTFILE}"
$CMD
RETURN=$?
echo "Return from command $CMD is $RETURN"
Now the output for this is
Code:
Unrecognized command: 's/Searchstring.*/SearchstringAppendString/'
Return from command: sed -e 's/^Searchstring.*/SearchstringAppendString/' /tmp/test.txt > /tmp/test2.txt is 2
If I cut and paste the sed command, it runs perfectly.
I've tried many different combinations of the quotes, and escaping and it just doesn't seem to go well.
I went the route of not assigning it to a variable and just enclosing the string in backticks, that seemed to work fine, but the output file wasn't created.
Appreciate any help, thanks.