Issue with SUNOS running sed scripts


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Issue with SUNOS running sed scripts
# 1  
Old 07-08-2013
Issue with SUNOS running sed scripts

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

Code:
 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

Last edited by Scrutinizer; 07-08-2013 at 03:42 PM.. Reason: code tags
# 2  
Old 07-08-2013
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?
# 3  
Old 07-08-2013
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\
# 4  
Old 07-08-2013
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?
Code:
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?

Last edited by Scrutinizer; 07-08-2013 at 04:08 PM..
# 5  
Old 07-08-2013
I am running the command directly on putty . So no windows issues
I am copy pasting the entire command and its output
Code:
% sed ' /WORD/ a\
sample line 1 \
sample line2 \
' tt
sed: command garbled: /WORD/ a
% uname
SunOS
% which sed
/usr/bin/sed
%


Last edited by Scrutinizer; 07-08-2013 at 04:29 PM.. Reason: servername disclosed; code tags
# 6  
Old 07-08-2013
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)
# 7  
Old 07-08-2013
% sed ' /WORD/ a\sample line 1 \sample line2 \' ttsed: command garbled: /WORD/ a% unameSunOS% which sed/usr/bin/sed%
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Solaris

CLASSPATH Issue in SunOS

Hi Friends I need to add path to CLASSPATH in weblogic start OS is SunOS dcuatapp04 5.11 11.3 sun4v sparc sun4v I follow instructions given in below link. but even startup log shows the new path it does not load the jar file. how can i fix this Oracle WebLogic Server 12.1.3 Developer... (6 Replies)
Discussion started by: ded325
6 Replies

2. Shell Programming and Scripting

Issues with sed on SunOS

Why does the below command doesnt work fine on SunOS 5.10 $ cat t | AK| | | | | DS | | | | tAR | | | | | FIL | $ sed -e 's/^ *//g' -e 's/ *$//g' -e 's/ *| */|/g' t |AK|||||DS|||| tAR|||||FIL| ##notice before tAR works fine on Linux OR AIX though ... (8 Replies)
Discussion started by: Shivdatta
8 Replies

3. Shell Programming and Scripting

[Solved] Running scripts in parallel that issue prompt

Hi all - I am totally stuck here :wall I have been asked to write a shell script that does a few little things and then reads from a config file and kicks off an instance of another script, say scriptB.ksh for each line in the config file. These should all be run in parallel. This is all fine but... (2 Replies)
Discussion started by: sjmolloy
2 Replies

4. Shell Programming and Scripting

Making use of multiple cores for running sed and awk scripts

Hi All, After reading that the sort command in Linux can be made to use many processor cores just by using a simple script which I found on the internet, I was wondering if I can use similar techniques for programs like the awk and sed? #!/bin/bash # Usage: psort filename <chunksize>... (7 Replies)
Discussion started by: shoaibjameel123
7 Replies

5. UNIX for Dummies Questions & Answers

SunOs problem running crontab -e

Hi, Whenever I run crontab -e from my remote terminal logged onto a SunOS 5.6 machine I get this: root@beauvert:~> crontab -e 3495 ----- I think I have to set the terminal/editor. These are my environment variables: root@beauvert:~> set EDITOR vi PATH ... (5 Replies)
Discussion started by: mojoman
5 Replies

6. Shell Programming and Scripting

Running scripts within scripts from cron

Hi all, I have set up a cron job which calls another shell script shell script which in turn calls a Java process. The cron tab looks so. 0,30 7-18 * * 1-5 /u01/home/weblogic/brp/bin/checkstatus.sh >> /u01/home/weblogic/logs/checkstatus.log The checkstatus.sh scripts looks like this. ... (4 Replies)
Discussion started by: sirbrian
4 Replies

7. Shell Programming and Scripting

sed on SunOS 5.10

Hello all, I am having some problems using sed on a sunOS 5.10, I am using bash. For some reason the regexp I am trying to build is not working, even though it should. I am trying to parse some syslog messages and I need to match the first IP address , then replace it with something else.... (11 Replies)
Discussion started by: sylaan
11 Replies

8. UNIX for Advanced & Expert Users

SunOS 5.8 performance issue

Hi all On my SUNOS 5.8 server I am facing a serious performance issue. After booting within 20-25 days the system performance degrates, even I can't executes commands such as df, top, etc the only options remains to reboot the system. There is no such memory consuming process runs and the... (1 Reply)
Discussion started by: zing_foru
1 Replies

9. Shell Programming and Scripting

Unix Korn Shell Array Issue (SunOS)

Hello, I'm currently messing around with arrays for the first time in scripting (Unix Korn Shell). All I'm trying to do right now before I make things complicated is read through and print out to screen whether the read file is or is not a directory. Here is my directory: ls -l total... (5 Replies)
Discussion started by: Janus
5 Replies

10. Shell Programming and Scripting

SQL scripts not running, possible timeout issue?

I am a novice Unix scripter and need a little advice/help on a script I've written that's causing some problems. We are using Solaris 9 on a Sun box and the script is invoked with the korn shell. I have a two-part question: I wrote a shell script that calls and executes 3 separate sql scripts,... (3 Replies)
Discussion started by: E2004
3 Replies
Login or Register to Ask a Question