LinuxQuestions.org
Latest LQ Deal: Linux Power User Bundle
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This 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


Reply
  Search this Thread
Old 03-09-2012, 01:25 AM   #1
uniami
LQ Newbie
 
Registered: Mar 2012
Posts: 2

Rep: Reputation: Disabled
Question 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?

Regards,
UniAmi
 
Old 03-09-2012, 01:47 AM   #2
EricTRA
LQ Guru
 
Registered: May 2009
Location: Gibraltar, Gibraltar
Distribution: Fedora 20 with Awesome WM
Posts: 6,805
Blog Entries: 1

Rep: Reputation: 1295Reputation: 1295Reputation: 1295Reputation: 1295Reputation: 1295Reputation: 1295Reputation: 1295Reputation: 1295Reputation: 1295
Hello and welcome to LinuxQuestions,

It would be good to let us know what distro, version and shell you are using on both sides of the SSH connection.

Looking forward to your participation in the forums.

Kind regards,

Eric
 
Old 03-09-2012, 02:37 AM   #3
uniami
LQ Newbie
 
Registered: Mar 2012
Posts: 2

Original Poster
Rep: Reputation: Disabled
Arrow

SSH version is as below.

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
 
Old 03-09-2012, 02:46 AM   #4
EricTRA
LQ Guru
 
Registered: May 2009
Location: Gibraltar, Gibraltar
Distribution: Fedora 20 with Awesome WM
Posts: 6,805
Blog Entries: 1

Rep: Reputation: 1295Reputation: 1295Reputation: 1295Reputation: 1295Reputation: 1295Reputation: 1295Reputation: 1295Reputation: 1295Reputation: 1295
Quote:
Originally Posted by uniami View Post
SSH version is as below.

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?

Kind regards,

Eric
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
[SOLVED] Replace a line using sed finekevin Linux - Newbie 6 02-23-2012 01:14 PM
sed command to replace line in text file gengwei89 Linux - Newbie 6 11-06-2011 08:10 AM
[SOLVED] Need sed help: s/ command won't replace two occurrences of pattern on same line GrapefruiTgirl Programming 7 12-16-2009 02:08 AM
help - how do i run a multi-line sed command in perl? rma88 Programming 2 10-09-2009 07:11 PM
SED - replace line after substing rany Linux - Newbie 2 07-02-2009 01:13 AM


All times are GMT -5. The time now is 07:51 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration