Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我正在浏览文件的每一行,用正则表达式在每一行中寻找一些特定的东西,我想打印它以便输出 .csv 文件的每一行只包含这些东西(thing1|thing2|thing3|thing4|)但是因为它正在经历一行一行我得到类似的东西
thing1|thing2|thing3|thing4|
||||
然后
|||thing4|
|thing1||thing3||
而且我不知道如何删除空的管道分隔区域以将所有内容推到一起。帮助?
You could filter it after with a regex
$out =~ s/\|{2}/|/sg;