2

I am trying to execute a shell file, in which there is a line:

sed -ne ':1;/PinnInstitutionPath/{n;p;b1}' Institution | sed -e s/\ //g | sed -e s/\=//g | sed -e s/\;//g | sed -e s/\"//g | sed -e s/\Name//g

And un error message turns out : "Label too long: :1;/PinnInstitutionPath/{n;p;b1}"

I am a noob at linux, so can anyone help me to solve this problem, thank you!

Jotne
  • 40,548
  • 12
  • 51
  • 55
  • What are you trying to do, and what does Institution look like? In general, 'sed' is a scripting language so you can use only one sed with statements separated by semicolons: http://stackoverflow.com/a/7657662/2327328 – philshem Dec 30 '13 at 13:41

2 Answers2

3

Try changing

sed -ne ':1;/PinnInstitutionPath/{n;p;b1}'

to

sed -ne ':1' -e '/PinnInstitutionPath/{n;p;b1}'

Also, you don't need to call sed so many times:

sed -ne 's/[ =;"]//g; s/Name//g' -e ':1' -e '/PinnInstitutionPath/{n;p;b1}'
Lev Levitsky
  • 63,701
  • 20
  • 147
  • 175
3

Concerning 'sed: Label too long' in Solaris (SunOS) - you will need to split your command into several lines, if you use labels. In your case

sed -ne ':1
    /PinnInstitutionPath/{
    n
    p
    b 1
    }' Institution | sed -e s/\ //g -e s/\=//g -e s/\;//g -e s/\"//g -e s/\Name//g
bravomail
  • 31
  • 1