【发布时间】:2017-07-18 08:20:49
【问题描述】:
我有一个包含很多行的文本文件,如下所示:
%% reason of the selling ?
%% they piggy-back on cingular 's service .
zone[-3] %% also , their t-zones ."
customer service[-2] %% since i received the phone.
%% 24 hours ?"
screen[-2] %% i must have heard this about a dozen times over the span"
我想删除所有以 %% 开头的行,并且还有一些中间包含 %% 的行,所以也删除 %% 直到该行的末尾。我想要这样的最终结果
zone[-3]
customer service[-2]
screen[-2]
【问题讨论】:
-
听起来像是一个 perl 任务。使用 split()。
-
sed 's/%%.*//; /^$/d'
标签: c++