Menu

Insert a CR LF into a string of text with NP

2008-12-04
2012-11-13
  • Julius Gazdag

    Julius Gazdag - 2008-12-04

    Hi there all, I have recently been given a couple of flat files that are basically a string of text. What I am neededing to do is at each "*", insert a CRLF to cause the next segment to drop to a new line.

    I know that I can find every * in the file, but I am really lost as to how can I get the application to insert the CR LF function. The file is a normal text document.

    There are about 4500 records in this line of text and there is no way I can make myself sit there and at every 512 position hit enter, so does anyone have any ideas?

    Thanks!!!

     
    • George Dawson

      George Dawson - 2008-12-04

      first di a search for *.
      Then go back to the start of the line, and create a macro.
      First command of the macro, F3, repete search for the *.
      Second command of the macro, press Enter.
      Stop recording your macro.

      Replay your Macro, again and again.

       
      • Fool4UAnyway

        Fool4UAnyway - 2008-12-04

        Please, OH PLEASE, stop introducing visitors into the world of macro's there is absolutely NO NEED to use one.

        Why bother them with functionality that is even more difficult than the question that they ask, including the answer to it?!

        First, some tips. Do some (re)search on these forums for:
        - regular expressions or regex
        - posts by me, Fool4UAnyway
        - linebreak or newline

        You may find some very useful messages, tips and tutorials.

        Now, a simple solution to your problem:

        Press Ctrl+R to open the advanced Replace dialog.

        In the Find field enter:
        *

        In the Replace field, enter a linebreak by pressing Ctrl+M, Ctrl+Enter or Shift+Enter.

        Make sure the regular expression and selection checkboxes are unchecked.

        Find the first * and replace all occurrences.