@zaxxon: The problem with GNU-sed is that in some regards it works in outright contradiction to the POSIX-standard which most other sed-implementations adhere to.
Quote:
Originally Posted by andyatit
Hi, I posted in another section, but no reply yet.
If you get no answer you might think about rephrasing your question. zaxxon already pointed out with his question that a vital piece of information was missing. If you think you posted in the wrong section erroneously and another board would be better suited please contact a moderator. We can move the thread for you and we really enjoy doing so, because this activity legitimate us having the right to boss around users. ;-))
Now to your problem: i think the problem is you didn't use a ";" to denote separate commands here:
but, honestly: this is a horrible way to write sed-scripts, especially long ones. You gain nothing from saving a few bytes of white space but lose the opportunity to read what you have written. In the interest of maintainability you might consider rewriting the script this way:
By the way: some sed-implementations don't like
and prefer a blank between "/" and "!". I remember writing a script with GNU-sed once which failed under AIX because of exactly this problem.
@zaxxon: The problem with GNU-sed is that in some regards it works in outright contradiction to the POSIX-standard which most other sed-implementations adhere to.
@bakunin:
I know - that's why I asked the latter
Like bakunin wrote it as non-one-liner, sed on AIX for example needs to have nested parts with curled brackets on their own line.
I'm using SunOS 5.10
not sure how to get more version info about sed than that
That is OK, "SunOS 5.10" already puts it in perspective. Note that with SunOS you need to use the tools in "/usr/xpg4/bin/" rather than in "/usr/bin". What is your "PATH" variable looking like?
Quote:
Originally Posted by andyatit
I put in as Bakunin said and still got a label too long error :
most frustrating as I know you said it works, so I'm not sure what I'm doing wrong.
Well, it worked on my systems - AIX and Fedora Linux - but all systems are slightly different. As it is i have no Solaris system at hand to test.
Try to shorten the indentation and see if this helps: move the content of the line ":skipline" to the leftmost position, clearing out the leading blanks. Second, try to change "skipline" to something shorter. My sed versions have no problem with labels 8 characters long, but maybe yours does. Change the line
too, of course. If this helps you have nailed down the reason, otherwise we will have to look for alternative explanations.
hello Team,
I am looking for sed command or script which will append word at end of line. for example. I want to validate particular filesystem with mount |<filesystem name> command. if nodev parameter is not there then it should add in the fstab file with receptive to the filesystem.
# mount... (8 Replies)
Hi,
$ cat f1
My name is Bruce and my surname is
I want to use SED to find “Bruce” and then append “ Lee” to the end of the line in which “Bruce” is found
Then a more tricky one…. I want to INSERT ….a string… in to a line in which I find sometihng. So example
$ cat f2
My name is... (9 Replies)
Hi,
I have a File, which have multiple rows.
Like below
123456 Test1 FNAME JRW#$% PB MO Approver XXXXXX. YYYY
123457 Test2 FNAME JRW#$% PB MO Super XXXXXX. YYYY
123458 Test3 FNAME JRW#$% PB MO Approver XXXXXX. YYYY
I want to search a line which contains PB MO Approver and append... (2 Replies)
im trying to append to the end of the line using sed but I want to do it without creating a new line
the text to which I want to append is all in capital letters.
I want to do something like this:
LINE]Foo
but when I do this:
//a\
] Foo
it prints foo on a new line:
LINE
]Foo
... (11 Replies)
Input:
gstreamer-plugins-good
gstreamer-plugins-bad
gstreamer-plugins-ugly
Output should be:
gstreamer-plugins-good gstreamer-plugins-bad gstreamer-plugins-ugly
How can it be done with sed? (5 Replies)
Hi all
I tried this on an old version of sed on NCR Unix MP-RAS:
sed -e "s/$/nnn/" file1 >file2
This file (file1):
the cat sat on the mat.
the cat sat on the mat.
the cat sat on the mat.
becomes this (file2):
the cat sat on the mat.nnn
the cat sat on the mat.nnn
nnn
the... (3 Replies)
Hello to all,
On aix, I want to identify a term on a line in a file and then add a word at the end of the line identified. I do not want the word to be added when the line contains the symbol "#".
I use the following command, but it deletes the term identified then adds the word.
#sed... (4 Replies)
Anyone know how to use SED to append a comma to the end of each line
example:
field1,field2,field3,field4
If i Cat /textfile ---- How can i append the end of /textfile with a comman? (8 Replies)
Hey - my first post here, and I'm a total SED newb. I've looked around for previous help on this, but have so far been unsuccessful.
I have a program (AMStracker for OS X) that outputs data in the terminal. Output is in this form:
.
.
.
3 0 -75
3 0 -76
3 0 -77
... (4 Replies)