开发者

How can I delete all but every fourth line in a text file?

开发者 https://www.devze.com 2022-12-09 06:41 出处:网络
I have a log that looks like this: line 1 line 2 line 3 line 4 line 1 line 2 line 3 line 4 How can I use AHK to delete lines 1, 2, and 3, but skip the fourth,开发者_JS百科 and then continue to loop

I have a log that looks like this:

line 1
line 2
line 3
line 4
line 1
line 2
line 3
line 4

How can I use AHK to delete lines 1, 2, and 3, but skip the fourth,开发者_JS百科 and then continue to loop?


Your using the wrong tool for the job. (Not to mention that how to use software is a superuser.com question)

The solution is to open up a terminal and type:

tail -n+4 yourFileWithLines

That will work perfectly. On windows install cygwin to get tail. (<== That could almost be a twss joke)


This is not the direct answer you are expecting, but if you install cygwin (I guess you are working in Windows) and try grep & less. You will soon realize they are the right tool for your purpose.

0

精彩评论

暂无评论...
验证码 换一张
取 消