可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试):
问题:
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