Sed 标签太长
我正在尝试执行一个shell文件,其中有一行:Sed 标签太长,sed,Sed,我正在尝试执行一个shell文件,其中有一行: 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 而un错误消息的结果是:“标签太长::1;/pinnstittutionpath/{n;p;b1}” 我是linux的noob,所以谁能帮我解决这个问题,谢谢 试试
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
而un错误消息的结果是:“标签太长::1;/pinnstittutionpath/{n;p;b1}”
我是linux的noob,所以谁能帮我解决这个问题,谢谢 试试换衣服
sed -ne ':1;/PinnInstitutionPath/{n;p;b1}'
到
此外,您不需要多次调用sed
:
sed -ne 's/[ =;"]//g; s/Name//g' -e ':1' -e '/PinnInstitutionPath/{n;p;b1}'
关于Solaris(SunOS)中的“sed:Label太长”-如果使用标签,则需要将命令拆分为几行。 在您的案例中-ne':1 /皮恩学院路/{ N P b 1
}'Institution|sed-es/\//g-es/\=///g-es/\\//g-e s/\“//g-e s/\Name//g您想做什么,机构是什么样子的?一般来说,“sed”是一种脚本语言,因此您只能使用一个sed,其语句之间用分号分隔:谢谢!它工作得很好,注意它会显示另一个错误消息“过多{”“,我也不知道为什么…我可以忽略它吗?@user2889802我不确定,首先检查一下命令,也许你忘了关闭
}
?
sed -ne 's/[ =;"]//g; s/Name//g' -e ':1' -e '/PinnInstitutionPath/{n;p;b1}'
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