0

I am trying to execute send "sed -e\'s/%\([0-9A-F][0-9A-F]\)/\\\\\x\1/g\' test_log" from within the spawn but it is throwing me this error:

bash-4.1$ invalid command name "0-9A-F"
while executing
"0-9A-F"
invoked from within
"send "sed -e\'s/%\([0-9A-F][0-9A-F]\)/\\\\\x\1/g\' test_log""
(file "./test.sh" line 19)

I have added \ too for escape character in sed, but still it is not working.

What am I missing here?

Sparkplug
  • 485
  • 7
  • 21

1 Answers1

0

Don't escape the single quote in sed
i.e. use

sed -e's/%\([0-9A-F][0-9A-F]\)/\\\\\x\1/g' test_log  

and not

sed -e\'s/%\([0-9A-F][0-9A-F]\)/\\\\\x\1/g\' test_log
Cyrus
  • 84,225
  • 14
  • 89
  • 153
Marichyasana
  • 2,966
  • 1
  • 19
  • 20
  • Still not working. Same error. invalid command name "0-9A-F" while executing "0-9A-F" invoked from within "send "sed -e's/%\([0-9A-F][0-9A-F]\)/\\\\\x\1/g' test_log"" (file "./fetch_log.sh" line 19) – Sparkplug Mar 25 '16 at 10:16