vash
July 8, 2013, 2:21pm
1
Hi
I probably dont have GNU extended sed in my SUNOS . and its creating lot of problems
ex:
a simple sed command like this is not working
sed '/WORD/ a\
sample text line 1 \
sample text line 1
' filename
sed: command garbled: /WORD/ a
I took precaution to have a new line after a\
tried with ^J for new line also different syntaxes like ; after a liek a;\ and then new line
Nothing worked ...
Please help
Your command like you posted it should work. Could it be that there is a space after the first backslash with your original command, that is not present in the sample you posted here?
vash
July 8, 2013, 2:49pm
3
absolutely Not I dont have a space or anythign . like i mentioned in the post i double triple checked if i have a new line starting after a\
Try copy-pasting your own sample on this page back on to the command prompt, what do you get?
Also is the error message exactly like you posted it without a \
at the end?
sed: command garbled: /WORD/ a
--- edit ---
Another possibility, does your file contain CR-LF , i.e could it be that your command is in a script file that is in DOS format?
vash
July 8, 2013, 3:23pm
5
I am running the command directly on putty . So no windows issues
I am copy pasting the entire command and its output
% sed ' /WORD/ a\
sample line 1 \
sample line2 \
' tt
sed: command garbled: /WORD/ a
% uname
SunOS
% which sed
/usr/bin/sed
%
I mean copy and paste the very sample that you posted earlier on this page in post#1. (select that sample and copy-paste into putty)
vash
July 8, 2013, 3:50pm
7
% sed ' /WORD/ a\sample line 1 \sample line2 \' ttsed: command garbled: /WORD/ a% unameSunOS% which sed/usr/bin/sed%
Ensure you don't have a C-shell!
exec bash
1 Like
That is not the sample of post #1 ..
Hi,
I think below sed usage can help you
uname -a
SunOS ams2 5.10 Generic_144488-09 sun4v sparc SUNW,T5240
cat >deney
Goksel Yangin
Goksel Yangin
^Z
[1]+ Stopped cat >deney
cat deney | sed -e 's/Yangin/Goksel/g'
Goksel Goksel
Goksel Goksel
Regards,
Goksel Yangin
Computer Engineer
vash
July 9, 2013, 7:12am
11
Now that worked ! Thank you . i know there was some thing i was missing.
Thanks!