perl中去除从&到+号的所有字符例如:+apple&apple1apple2apple3+pearpear&pear1+orange除去从&到+号的所有字符后应剩下+applepearpearorangeperl -i -pe 's/\&.\+//sg' out.txt这个是我写的,但是out.txt中并没有出现+applepe
来源:学生作业帮助网 编辑:作业帮 时间:2024/08/29 01:05:12
![perl中去除从&到+号的所有字符例如:+apple&apple1apple2apple3+pearpear&pear1+orange除去从&到+号的所有字符后应剩下+applepearpearorangeperl -i -pe 's/\&.\+//sg' out.txt这个是我写的,但是out.txt中并没有出现+applepe](/uploads/image/z/15238406-38-6.jpg?t=perl%E4%B8%AD%E5%8E%BB%E9%99%A4%E4%BB%8E%26%E5%88%B0%2B%E5%8F%B7%E7%9A%84%E6%89%80%E6%9C%89%E5%AD%97%E7%AC%A6%E4%BE%8B%E5%A6%82%EF%BC%9A%2Bapple%26apple1apple2apple3%2Bpearpear%26pear1%2Borange%E9%99%A4%E5%8E%BB%E4%BB%8E%26%E5%88%B0%2B%E5%8F%B7%E7%9A%84%E6%89%80%E6%9C%89%E5%AD%97%E7%AC%A6%E5%90%8E%E5%BA%94%E5%89%A9%E4%B8%8B%2Bapplepearpearorangeperl+-i+-pe+%27s%2F%5C%26.%5C%2B%2F%2Fsg%27+out.txt%E8%BF%99%E4%B8%AA%E6%98%AF%E6%88%91%E5%86%99%E7%9A%84%2C%E4%BD%86%E6%98%AFout.txt%E4%B8%AD%E5%B9%B6%E6%B2%A1%E6%9C%89%E5%87%BA%E7%8E%B0%2Bapplepe)
xNP_(6_`I%$%(HBIKB-̙|υ*jTXdNP )GAzDڳʙySuC
N^_ZBDQ2OF~A#*xBR$2b\¬>*`{qE\))̋aARQI̪N2}UT>]1MWnМYehUp0)Jm"k?s&$%GO+P7ޱggZ,Hڣ>2n1ٺf^?Zgkc
perl中去除从&到+号的所有字符例如:+apple&apple1apple2apple3+pearpear&pear1+orange除去从&到+号的所有字符后应剩下+applepearpearorangeperl -i -pe 's/\&.\+//sg' out.txt这个是我写的,但是out.txt中并没有出现+applepe
perl中去除从&到+号的所有字符
例如:
+apple
&apple1
apple2
apple3
+pear
pear
&pear1
+orange
除去从&到+号的所有字符后应剩下
+apple
pear
pear
orange
perl -i -pe 's/\&.\+//sg' out.txt
这个是我写的,但是out.txt中并没有出现
+apple
pear
pear
orange
perl中去除从&到+号的所有字符例如:+apple&apple1apple2apple3+pearpear&pear1+orange除去从&到+号的所有字符后应剩下+applepearpearorangeperl -i -pe 's/\&.\+//sg' out.txt这个是我写的,但是out.txt中并没有出现+applepe
Perl之命令行
通过它可以让你的程序更简练,并且可以写出很多只有一行命令的perl.
perl -0777 -pe 's/&.+?\+//sg' file
answer补充:
perl -0777 -pe 's/&.+?\+//sg' 122.txt> out.txt
你抄都抄错了 ...
是-0777不是-i
是&不是\&