There are too many '{'


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting There are too many '{'
# 1  
Old 11-08-2014
Error There are too many '{'

Let's say
Code:
X="MyJVM"

Here's the command I'm trying to run -
Code:
sed -n "/serverName=\"${X}\"/,/<\/serverEntries>/{/BOOTSTRAP_ADDRESS/{n;s/.*port=\"\([^\"]*\)\".*/\1/;p;};}" serverindex.xml

It fails saying -
Code:
sed: 0602-413 There are too many '{'.

Whereas this works -
Code:
sed -n "/serverName=\"${X}\"/,/<\/serverEntries>/{
    /BOOTSTRAP_ADDRESS/{n;s/.*port=\"\([^\"]*\)\".*/\1/;p;}
}" serverindex.xml

Any way to fix the first command?
# 2  
Old 11-08-2014
They are not the same.

Code:
sed -n "/serverName=\"${X}\"/,/<\/serverEntries>/{/BOOTSTRAP_ADDRESS/{n;s/.*port=\"\([^\"]*\)\".*/\1/;p;};}" serverindex.xml

sed -n "/serverName=\"${X}\"/,/<\/serverEntries>/{
    /BOOTSTRAP_ADDRESS/{n;s/.*port=\"\([^\"]*\)\".*/\1/;p;}
}" serverindex.xml

Login or Register to Ask a Question

Previous Thread | Next Thread
Login or Register to Ask a Question