As I mentioned in your answer about your other question, Solaris sed
is an old school and requires more hands (or, to put it another way), is more fussy about the syntax.
All you need is an extra ';' char placed after the `d 'char, i.e.
sed '/Location/{n; d;}'
More generally, everything that can be on a new line inside {...}
needs a comma delimited delimiter when it is collapsed onto one line. However, you cannot collapse the "a", "i", "c" commands on one line, as you can on Linux.
In the standard Solaris saddle, the commands' a ', i', 'c' need a trailing '\' without NO spaces or tabs after it, as much data as you like (probably within some K) on \n
completed lines ( NO \r
s) followed by an empty string.
Newer Solaris installations can also be installed /usr/xpg4/bin/sed
. Try
/usr/xpg4/bin/sed '/Location/{n; d}'
If you're lucky, it will support your shortcut syntax. I do not have access to any solar cars to test this.
Finally, if that doesn't work, there are GNU tool packages that can be installed that will have sed
, which is much more like what you are used to with Linux. Ask your system administrators if GNU tools are already available or can be installed. I'm not sure which version of gnu sed
started supporting the "relaxed" syntax, so don't assume that it will be fixed without testing :-)
Hope this helps.
PS Welcome to StackOverflow and let me remind you of the three things we usually do here: 1) As you get help, try giving it as well by answering questions in your area of expertise. 2) Read the frequently asked questions, http://tinyurl.com/2vycnvr , 3) When you see good Q&A, vote for them using the gray triangles, http://i.imgur.com/kygEP.png , as trust in the system is based on the reputation that users gain by sharing their knowledge. Also, do not forget to accept the answer that better solves your problem, if any, by clicking the check mark, http://i.imgur.com/uqJeW.png