SED replace line command throwing parsing error when run through SSH
Linux - NewbieThis Linux forum is for members that are new to Linux.
Just starting out and have a question?
If it is not in the man pages or the how-to's this is the place!
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
SED replace line command throwing parsing error when run through SSH
Hi,
I am trying to replace the encrypted password in my file using sed.
When I run below command locally, it works fine.
export VAR=XYZ
sed '
/password-encrypted/ c\
<password-encrypted>'$VAR'</password-encrypted>
' PASSWORD.xml > new.XML
But when I try to run same command using SSH, it gives parsing error.
ssh -q $HOST -l $LOGNAME -n "
sed '
/password-encrypted/ c\\
<password-encrypted>XYZ</password-encrypted>
' PASSWORD.xml > new.XML
"
sed: Function /password-encrypted/ c\ <password-encrypted>XYZ</password-encrypted> cannot be parsed.
Can someone please assist and let me know what correction is needed?
OpenSSH_5.3p1+sftpfilecontrol-v1.3-hpn13v5, OpenSSL 0.9.8n 24 Mar 2010
HP-UX Secure Shell-A.05.30.009, HP-UX Secure Shell version
For test run, I am doing ssh to the same account. SHELL variable is set to ksh.
Regards,
UniAmi
Hi,
I was referring to the operating system distro and version, not SSH, although that's good to know too. Are you using the same Linux distro, version and shell on both sides?
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.