-3

I have a very big file which contains ~XXX as delimiter. For every occurence of that string I need to start from newline.I need a windows batch file

example :12312312312312@XXXqewqweqweqweqweqweqweqwe@XXX123KJFLKJSFLKJ@XXXsfdsdf

OutPut:

12312312312312
@XXXqewqweqweqweqweqweqweqwe
@XXX123KJFLKJSFLKJ
@XXXsfdsdf

Appreciate your response.

Thanks NK

  • 1
    Is the leading colon part of the example or a mistake? Is it `~XXX` or `@XXX` ? What code have you written so far, where did you get stuck? [SO] isn't a script writing service. –  May 10 '17 at 22:11
  • 1
    What scale is a very big file for you? Batch processing is limited by maximum cmdline length. –  May 10 '17 at 22:19
  • Possible duplicate of [How can you find and replace text in a file using the Windows command-line environment?](http://stackoverflow.com/questions/60034/how-can-you-find-and-replace-text-in-a-file-using-the-windows-command-line-envir) – Mofi May 12 '17 at 05:30

1 Answers1

0

PowerShell may be better suited to the task, a minimal example:

> "12312312312312@XXXqewqweqweqweqweqweqweqwe@XXX123KJFLKJSFLKJ@XXXsfdsdf" -replace '@XXX', "`n@XXX"
12312312312312
@XXXqewqweqweqweqweqweqweqwe
@XXX123KJFLKJSFLKJ
@XXXsfdsdf

There are ways to read from file in chunks or use a streamreader.