How to batch remove all lines after the nth line?
-
I have a bunch of text files each having a different number of lines. I want to keep only the first 100 lines in each file. How can I do that?
Thanks in advance,
Mel -
Find:
\A(?-s)(?:^.*\R){100}\K(?s).*
Replace: nothing
Search mode: Regular expressionSuggest backing up all of your data before trying this.
-
Works like a charm! Thank you very much @Alan-Kilborn🙏🏽
-
Learn more to be able to apply such techniques on your own in the future; start HERE.
Hello! It looks like you're interested in this conversation, but you don't have an account yet.
Getting fed up of having to scroll through the same posts each visit? When you register for an account, you'll always come back to exactly where you were before, and choose to be notified of new replies (either via email, or push notification). You'll also be able to save bookmarks and upvote posts to show your appreciation to other community members.
With your input, this post could be even better 💗
Register Login