tags:

views:

19

answers:

2

hi

I am try to do the following on sun solaris

    sed   "/ADDRESS/a \
           PROTOCOL"  file  > NEW_file

but I get:

sed: command garbled: /ADDRESS/a PROTOCOL

why (on linux its work) ,

is it possible to support syntax that work on linux and on sun

lidia

A: 

here's another way, use nawk

nawk '/ADDRESS/{$0=$0" PROTOCAL"}1' file
ghostdog74
not good I want to add the PROTOCOL under the line ADDRESS not after the word ADDRESS
lidia
then add a newline "\n". Not that hard to try it out yourself! You have been asking a lot of questions about shell scripting, you should know how to use awk by now!!!! I am not going to spoonfeed you all the way..!!
ghostdog74
A: 

This syntax is a Gnu sed extension. It works on Gnu/Linux because you have a Gnu userland with it. It works on Solaris if Gnu sed is installed on it. It might be in /usr/gnu/bin/sed, /usr/sfw/bin/gsed or somewhere else, depending on the Solaris release you are using.

jlliagre