Results 1 to 3 of 3
I am trying to write a script to access sqlplus and use the output to replace the result in another file. But I am having some issues with it (This ...
Enjoy an ad free experience by logging in. Not a member yet? Register.
- 08-30-2010 #1Just Joined!
- Join Date
- Oct 2004
- Posts
- 10
sed & script help
I am trying to write a script to access sqlplus and use the output to replace the result in another file. But I am having some issues with it (This script is just a test script and I am just trying to print the updated value.
#!/bin/bash
I am not able to post the sqlplus connection, but it works.
bb=$a
echo a is $a
echo bb is $bb
var=he-llo
echo "goodbye friend" | sed "s/goodbye/$var/"
echo "goodbye friend" | sed "s/goodbye/$bb/"
The output I get is
a is 30-APR-10
bb is 30-APR-10
he-llo friend
sed: -e expression #1, char 10: unterminated `s' command
I am not sure why the last statement alone is not executing. Am I missing something?
Thanks.
- 08-30-2010 #2Just Joined!
- Join Date
- Aug 2010
- Posts
- 18
So I don't see any problems.Code:[root@server ~]$ bb="30-APR-10" [root@server ~]$ echo "goodbye friend" | sed -e "s/goodbye/$b/" 30-APR-10 friend [root@server ~]$
Where do you assign $bb?
- 08-30-2010 #3Just Joined!
- Join Date
- Oct 2004
- Posts
- 10
Thanks for the reply. I am assigning bb=$a in the 2nd line.
Anyways it seems escaping the newlines did the trick.
bb=${bb//$'\n'/}
Thanks again.


Reply With Quote
