-1

I have a huge text file with over 20K lines of content. I am using editplus 4.0 version to achieve my desired result.

What I want to do is;

I want to insert/append a keyword, randomly in the content. Now, the condition is, I want to insert my keyword once for every 60 lines.

If I achieve this, next I have another app which can split my huge content into multiple lines based on line count, which is 60 in this case.

So, end of the day I will have my content into multiple text files and every file includes my keyword which I am going to use it for blog posting.

Please suggest me if I can do this with editplus, other ways of achieving the same will also welcome.

I tried lot of options but no luck.

Thanks in advance !!

Muhammad Azhar
  • 101
  • 1
  • 1
  • 7
  • No you can't do that using editplus. You should do it in a programming language of your choice. Basically open the file, add your content every x line number close the file. – Jorge Campos Jan 18 '17 at 14:20
  • Thanks for your reply Jorge, can you through some php code to do this. – Muhammad Azhar Jan 18 '17 at 14:22
  • 1
    Sorry, no, you have to show some effort first. StackOverflow is not a free service code. Try it yourself first, then, if you get stuck with your code you edit your question with it. – Jorge Campos Jan 18 '17 at 14:29
  • @MuhammadAzhar have you tried something like find: `/((?:^[^\n]*\n){59}^[^\n]*)/gm` replace: `\1KEYWORD` ([see demo](https://regex101.com/r/GPytkp/1)) – logi-kal Jan 18 '17 at 14:39

1 Answers1

0

AFAIK editplus doesn't work with regex.

I suggest you to use Notepad++, with it you can do:

  • Ctrl+H
  • Find what: ((?:[^\r\n]*\R){60})
  • Replace with: $1KEYWORD\n
  • Replace all

Don't forget to select Regular expression in search mode.

Toto
  • 89,455
  • 62
  • 89
  • 125