Community

    • Login
    • Search
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search

    Cut the number of characters in all documents

    Help wanted · · · – – – · · ·
    2
    5
    2047
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • Stas
      Stas last edited by

      Hi!
      Please tell me how I can cut the number of characters in all txt documents?
      I have thousands of txt documents with different number of characters, but I need to leave for all of them only 500 characters. Thank you!

      Scott Sumner 1 Reply Last reply Reply Quote 0
      • Scott Sumner
        Scott Sumner @Stas last edited by

        @Stas

        This sounds like a dangerous operation to me, so be sure you have a backup of all your files before beginning.

        You could try a Replace In Files operation:

        Find what:
        (?s).{500}\K.*

        Replace with:
        make sure this box is empty

        Search mode:
        Regular expression

        Stas 1 Reply Last reply Reply Quote 1
        • Stas
          Stas @Scott Sumner last edited by

          @Scott-Sumner

          Thank you very much!

          Scott Sumner 1 Reply Last reply Reply Quote 0
          • Scott Sumner
            Scott Sumner @Stas last edited by

            @Stas

            You replied very fast – did you try it? Did it work?

            Stas 1 Reply Last reply Reply Quote 0
            • Stas
              Stas @Scott Sumner last edited by

              @Scott-Sumner said:

              (?s).{500}\K.*

              checked, it works!
              Thank you

              1 Reply Last reply Reply Quote 0
              • First post
                Last post
              Copyright © 2014 NodeBB Forums | Contributors