假设我有一个文本文件,其中包含来自不同来源的记录。该文件如下所示:
1000 Once upon a time, happy end.
1001 Tornado in NY city, the statue was finally found.
1002 I bought her an iphone
yes
for $1000. And then
happy end.
1003 How many times
have I seen it?
not many. Actually.
1004 5 Cars. 2 Toys. 3 Birds.
每行都以行号开头,\n
例如 {1000...2000}。行号用制表符与文本分开\t
。
那么如何计算"."
with sed in one的出现record
呢?
sed可以替换除模式中给出的字符之外的所有字符而不将它们分组[^...]
吗?
输出应如下所示:
1000 1
1001 1
1002 2
1003 2
1004 3