Solaris sed label too long

匿名 (未验证) 提交于 2019-12-03 01:05:01

问题:

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!

回答1:

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}' 


回答2:

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


标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!