Community
    • Login

    1000 files, increment each first line number by 1

    Scheduled Pinned Locked Moved Help wanted · · · – – – · · ·
    16 Posts 3 Posters 1.0k Views
    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.
    • nextstepN
      nextstep @Javier Rivas
      last edited by

      @Javier-Rivas Yes please, that would be great! Thank you. I had done it once before and I was sure it was with notepad++ but maybe it was a bat.

      Javier RivasJ 1 Reply Last reply Reply Quote 0
      • Javier RivasJ
        Javier Rivas @Ekopalypse
        last edited by

        @Ekopalypse I’m new here, can we share batch file here, if it helps to rename file names? I believe that is what he is asking to rename a .txt filename by adding 000 in front on his filename and counting. I would of never thought that notepad++ can rename a txt filename

        nextstepN EkopalypseE 2 Replies Last reply Reply Quote 0
        • Javier RivasJ
          Javier Rivas @nextstep
          last edited by

          @dajaridi to make sure I understand this, you have 100 .txt files and you would like to rename all the txt files by adding a counter in front of the name right, 001 filename.txt, 002 filename.txt and so on

          1 Reply Last reply Reply Quote 0
          • nextstepN
            nextstep @Javier Rivas
            last edited by

            @Javier-Rivas No, not the text file name itself, but the first line of text in each file.

            Javier RivasJ 2 Replies Last reply Reply Quote 0
            • EkopalypseE
              Ekopalypse @Javier Rivas
              last edited by Ekopalypse

              @Javier-Rivas

              You can add the source of the batch file by adding ~~~.
              before and after the source, but you can’t attach files to the post.
              For example

              @echo off
              set X=%%1
              ...
              

              But I think OP is asking about manipulating the file contents
              instead of the individual file names.

              nextstepN 1 Reply Last reply Reply Quote 0
              • Javier RivasJ
                Javier Rivas @nextstep
                last edited by

                @dajaridi the context of a file, like you are editing a txt files and inside you have
                Example
                I am
                John
                Smith

                And in front of that you want a counter
                001 I am
                002 John
                003 Smith

                Like it’s counting rows, if please give an example

                nextstepN 1 Reply Last reply Reply Quote 0
                • nextstepN
                  nextstep @Ekopalypse
                  last edited by

                  @Ekopalypse Yes, adding a number starting with 000, last being 999 to the first line of text. Thanks for contributing

                  1 Reply Last reply Reply Quote 0
                  • Javier RivasJ
                    Javier Rivas @nextstep
                    last edited by

                    @dajaridi ok, ok I think I got only the first line, only the first line of context on each txt file

                    nextstepN 1 Reply Last reply Reply Quote 0
                    • nextstepN
                      nextstep @Javier Rivas
                      last edited by

                      @Javier-Rivas

                      All files have the first line: first_line_of_text_

                      and would like to make the first line of each file:

                      the_first_file.txt
                      first_line_of_text_000

                      the_second_file.txt
                      first_line_of_text_001

                      1 Reply Last reply Reply Quote 0
                      • nextstepN
                        nextstep @Javier Rivas
                        last edited by

                        @Javier-Rivas Yes!

                        Javier RivasJ 1 Reply Last reply Reply Quote 0
                        • Javier RivasJ
                          Javier Rivas @nextstep
                          last edited by

                          @dajaridi my files do that but for file names, I’ll do my best to help you

                          nextstepN 2 Replies Last reply Reply Quote 0
                          • nextstepN
                            nextstep @Javier Rivas
                            last edited by

                            @Javier-Rivas If you have an idea that might help, I would be thankful>
                            For renaming a number of files I use a very useful utility called BulkRename Utility.

                            1 Reply Last reply Reply Quote 0
                            • nextstepN
                              nextstep @Javier Rivas
                              last edited by

                              @Javier-Rivas I have been able to achieve my objext using notepad++ although it is quite inelegant.

                              I have a folder with 1000 text files, which I duplicated. I then renamed them with a suffix 000.txt -> 999.txt

                              Each file has a unique first line, with a name and number, and all I did was do a search and replace to add in an extra zero and change the _001 to _0001

                              It will give me a unique first line, but will be a little more messy when combine with the other folder – but will work for what I am after.

                              Thanks for your help!! Most appreciates.

                              Daja

                              PS I know I’ve done it before, and it’s driving me nuts that I don’t remember how or where I found it…

                              1 Reply Last reply Reply Quote 0
                              • First post
                                Last post
                              The Community of users of the Notepad++ text editor.
                              Powered by NodeBB | Contributors