View Full Version : sed command not working?
January 29th, 2008, 03:05 PM
This has been really bugging me :-/
echo "HOME123" | sed "s/HOME123/$HOME/g" > gconf4.xml
I get this output:
sed: -e expression #1, char 12: unknown option to `s'
What am I doing wrong?
January 29th, 2008, 04:23 PM
Your shell replaces $HOME with /home/username which contains one or more "/" characters. This means that when you try to execute your command sed is actually run as
which is obviously an error.
Try changing the command with:
echo "HOME123" | sed "s;HOME123;$HOME;g" > gconf4.xml
In fact, sed allows you use any character you like as a delimiter in a substitute command (s///).
January 29th, 2008, 06:13 PM
Oh cool. Thanks its working!
Thanks for taking your time to help me!
Powered by vBulletin® Version 4.2.2 Copyright © 2014 vBulletin Solutions, Inc. All rights reserved.