【发布时间】:2016-10-23 08:11:15
【问题描述】:
请查看下面的示例文件和所需的输出以了解我在寻找什么。
这可以通过 shell 脚本中的循环来完成,但我很难获得一个 awk/sed 一个衬里。
SampleFile.txt
These are leaves.
These are branches.
These are greenery which gives
oxygen, provides control over temperature
and maintains cleans the air.
These are tigers
These are bears
and deer and squirrels and other animals.
These are something you want to kill
Which will see you killed in the end.
These are things you must to think to save your tomorrow.
期望的输出
These are leaves.
These are branches.
These are greenery which gives oxygen, provides control over temperature and maintains cleans the air.
These are tigers
These are bears and deer and squirrels and other animals.
These are something you want to kill Which will see you killed in the end.
These are things you must to think to save your tomorrow.
【问题讨论】:
-
模式是什么?没有注释,下一行以小写字符开头?还是只是“不是这些”?
-
必须是单线吗?
-
如果您可以在 shell 脚本中执行此操作,请调用该 shell 脚本。那是你的单线。
-
我是认真的。如果您有解决方案,为什么还需要另一个解决方案?您的 shell 循环解决方案是否太慢了,因为您有大量输入,还是存在其他问题?
-
@Kusalananda:它的文件大小超过 4GB,我正在尝试处理。除了时间因素(一个主要原因),正如您正确提到的,它的好奇心!