Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. The Lounge
  3. Combine TXT Files

Combine TXT Files

Scheduled Pinned Locked Moved The Lounge
toolsquestion
15 Posts 9 Posters 0 Views 1 Watching
  • 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.
  • F Offline
    F Offline
    Frank Deo
    wrote on last edited by
    #1

    Does anyone know of a utility (free or shareware), or of a way to combine several txt files into one file ignoring all comments in each file? ie: //comment file 1 # comment file 1 ; comment file 1 include this! //comment file 2 # comment file 2 ; comment file 2 and include this! the resulting file would contain: include this! and include this! Thanks! Frank

    C J M J 4 Replies Last reply
    0
    • F Frank Deo

      Does anyone know of a utility (free or shareware), or of a way to combine several txt files into one file ignoring all comments in each file? ie: //comment file 1 # comment file 1 ; comment file 1 include this! //comment file 2 # comment file 2 ; comment file 2 and include this! the resulting file would contain: include this! and include this! Thanks! Frank

      C Offline
      C Offline
      Christian Graus
      wrote on last edited by
      #2

      Sounds like about an hours work. Why don't you write one ? Christian No offense, but I don't really want to encourage the creation of another VB developer. - Larry Antram 22 Oct 2002
      C# will attract all comers, where VB is for IT Journalists and managers - Michael P Butler 05-12-2002
      Again, you can screw up a C/C++ program just as easily as a VB program. OK, maybe not as easily, but it's certainly doable. - Jamie Nordmeyer - 15-Nov-2002

      J F 3 Replies Last reply
      0
      • C Christian Graus

        Sounds like about an hours work. Why don't you write one ? Christian No offense, but I don't really want to encourage the creation of another VB developer. - Larry Antram 22 Oct 2002
        C# will attract all comers, where VB is for IT Journalists and managers - Michael P Butler 05-12-2002
        Again, you can screw up a C/C++ program just as easily as a VB program. OK, maybe not as easily, but it's certainly doable. - Jamie Nordmeyer - 15-Nov-2002

        J Offline
        J Offline
        Jon Newman
        wrote on last edited by
        #3

        Public enemy no. 1 for the lazy man as ever :-)

        We brought out this new and very similar version of our expensive software because the old version was......old....It's a good enough excuse for Microsoft so its fine for us.

        1 Reply Last reply
        0
        • C Christian Graus

          Sounds like about an hours work. Why don't you write one ? Christian No offense, but I don't really want to encourage the creation of another VB developer. - Larry Antram 22 Oct 2002
          C# will attract all comers, where VB is for IT Journalists and managers - Michael P Butler 05-12-2002
          Again, you can screw up a C/C++ program just as easily as a VB program. OK, maybe not as easily, but it's certainly doable. - Jamie Nordmeyer - 15-Nov-2002

          F Offline
          F Offline
          Frank Deo
          wrote on last edited by
          #4

          Christian Graus wrote: Sounds like about an hours work. Why don't you write one ? Looking for an easy way out. Not to mention the fact that my file i/o programming ability is not the greatest in the world. :-O Frank

          C K 2 Replies Last reply
          0
          • C Christian Graus

            Sounds like about an hours work. Why don't you write one ? Christian No offense, but I don't really want to encourage the creation of another VB developer. - Larry Antram 22 Oct 2002
            C# will attract all comers, where VB is for IT Journalists and managers - Michael P Butler 05-12-2002
            Again, you can screw up a C/C++ program just as easily as a VB program. OK, maybe not as easily, but it's certainly doable. - Jamie Nordmeyer - 15-Nov-2002

            F Offline
            F Offline
            Frank Deo
            wrote on last edited by
            #5

            NM...I wrote a batch file that copies the files, and then sorts the contents...making it easy for me to manually select / delete the comments. Thanks to all anyway! Frank

            1 Reply Last reply
            0
            • F Frank Deo

              Does anyone know of a utility (free or shareware), or of a way to combine several txt files into one file ignoring all comments in each file? ie: //comment file 1 # comment file 1 ; comment file 1 include this! //comment file 2 # comment file 2 ; comment file 2 and include this! the resulting file would contain: include this! and include this! Thanks! Frank

              J Offline
              J Offline
              Jon Sagara
              wrote on last edited by
              #6

              Perl[^] is your friend. :) Jon Sagara Working with a database is iterative, like sex, but painful instead of pleasurable. -- Marc Clifton[^]

              1 Reply Last reply
              0
              • F Frank Deo

                Christian Graus wrote: Sounds like about an hours work. Why don't you write one ? Looking for an easy way out. Not to mention the fact that my file i/o programming ability is not the greatest in the world. :-O Frank

                K Offline
                K Offline
                KaRl
                wrote on last edited by
                #7

                A good opportunity to learn :)


                Angels banished from heaven have no choice but to become demons Cowboy Bebop

                F C 2 Replies Last reply
                0
                • F Frank Deo

                  Christian Graus wrote: Sounds like about an hours work. Why don't you write one ? Looking for an easy way out. Not to mention the fact that my file i/o programming ability is not the greatest in the world. :-O Frank

                  C Offline
                  C Offline
                  Christian Graus
                  wrote on last edited by
                  #8

                  That's fair. Here's a great chance to improve it then !!! Seriously, read some iostream articles ( I have a few ) and then if you get stuck, post some questions. I'll be around for a few hours yet. Christian No offense, but I don't really want to encourage the creation of another VB developer. - Larry Antram 22 Oct 2002
                  C# will attract all comers, where VB is for IT Journalists and managers - Michael P Butler 05-12-2002
                  Again, you can screw up a C/C++ program just as easily as a VB program. OK, maybe not as easily, but it's certainly doable. - Jamie Nordmeyer - 15-Nov-2002

                  F 1 Reply Last reply
                  0
                  • K KaRl

                    A good opportunity to learn :)


                    Angels banished from heaven have no choice but to become demons Cowboy Bebop

                    F Offline
                    F Offline
                    Frank Deo
                    wrote on last edited by
                    #9

                    You are correct. I'll figure it out, and post an article here on how to do it. Just, please...don't give me a time limit. :-O Frank

                    1 Reply Last reply
                    0
                    • C Christian Graus

                      That's fair. Here's a great chance to improve it then !!! Seriously, read some iostream articles ( I have a few ) and then if you get stuck, post some questions. I'll be around for a few hours yet. Christian No offense, but I don't really want to encourage the creation of another VB developer. - Larry Antram 22 Oct 2002
                      C# will attract all comers, where VB is for IT Journalists and managers - Michael P Butler 05-12-2002
                      Again, you can screw up a C/C++ program just as easily as a VB program. OK, maybe not as easily, but it's certainly doable. - Jamie Nordmeyer - 15-Nov-2002

                      F Offline
                      F Offline
                      Frank Deo
                      wrote on last edited by
                      #10

                      Thanks for the support Christian. :) Frank

                      1 Reply Last reply
                      0
                      • K KaRl

                        A good opportunity to learn :)


                        Angels banished from heaven have no choice but to become demons Cowboy Bebop

                        C Offline
                        C Offline
                        Christian Graus
                        wrote on last edited by
                        #11

                        My sentiment exactly. Although I try to contrive projects that will teach me stuff, there is no substitute for actually having a use for the end product. Christian No offense, but I don't really want to encourage the creation of another VB developer. - Larry Antram 22 Oct 2002
                        C# will attract all comers, where VB is for IT Journalists and managers - Michael P Butler 05-12-2002
                        Again, you can screw up a C/C++ program just as easily as a VB program. OK, maybe not as easily, but it's certainly doable. - Jamie Nordmeyer - 15-Nov-2002

                        1 Reply Last reply
                        0
                        • F Frank Deo

                          Does anyone know of a utility (free or shareware), or of a way to combine several txt files into one file ignoring all comments in each file? ie: //comment file 1 # comment file 1 ; comment file 1 include this! //comment file 2 # comment file 2 ; comment file 2 and include this! the resulting file would contain: include this! and include this! Thanks! Frank

                          M Offline
                          M Offline
                          Michael Dunn
                          wrote on last edited by
                          #12

                          perl -ni.bak -e 'print unless m!^//! or /^#/ or /^;/;' file1.txt file2.txt > bigfile.txt

                          :cool: Yes, that is actual Perl, not line noise... although it is hard to tell them apart at first. --Mike-- I'm bored... Episode I bored. 1ClickPicGrabber - Grab & organize pictures from your favorite web pages, with 1 click! My really out-of-date homepage Sonork-100.19012 Acid_Helm

                          N B 2 Replies Last reply
                          0
                          • M Michael Dunn

                            perl -ni.bak -e 'print unless m!^//! or /^#/ or /^;/;' file1.txt file2.txt > bigfile.txt

                            :cool: Yes, that is actual Perl, not line noise... although it is hard to tell them apart at first. --Mike-- I'm bored... Episode I bored. 1ClickPicGrabber - Grab & organize pictures from your favorite web pages, with 1 click! My really out-of-date homepage Sonork-100.19012 Acid_Helm

                            N Offline
                            N Offline
                            Nitron
                            wrote on last edited by
                            #13

                            Michael Dunn wrote: that is actual Perl, not line noise... although it is hard to tell them apart at first. :laugh::laugh::laugh: - Nitron


                            "Those that say a task is impossible shouldn't interrupt the ones who are doing it." - Chinese Proverb

                            1 Reply Last reply
                            0
                            • F Frank Deo

                              Does anyone know of a utility (free or shareware), or of a way to combine several txt files into one file ignoring all comments in each file? ie: //comment file 1 # comment file 1 ; comment file 1 include this! //comment file 2 # comment file 2 ; comment file 2 and include this! the resulting file would contain: include this! and include this! Thanks! Frank

                              J Offline
                              J Offline
                              Jason Hooper
                              wrote on last edited by
                              #14

                              Um, hi, grep ? Oh yeah, Winshit. - Jason (SonorkID 100.611) The Code Project - Orange makes the art grow fonder

                              1 Reply Last reply
                              0
                              • M Michael Dunn

                                perl -ni.bak -e 'print unless m!^//! or /^#/ or /^;/;' file1.txt file2.txt > bigfile.txt

                                :cool: Yes, that is actual Perl, not line noise... although it is hard to tell them apart at first. --Mike-- I'm bored... Episode I bored. 1ClickPicGrabber - Grab & organize pictures from your favorite web pages, with 1 click! My really out-of-date homepage Sonork-100.19012 Acid_Helm

                                B Offline
                                B Offline
                                Bruce Duncan
                                wrote on last edited by
                                #15

                                RE's are fun! :cool:

                                Bruce Duncan, CP#9088, CPUA 0xA1EE, Sonork 100.10030
                                I can levitate birds...

                                1 Reply Last reply
                                0
                                Reply
                                • Reply as topic
                                Log in to reply
                                • Oldest to Newest
                                • Newest to Oldest
                                • Most Votes


                                • Login

                                • Don't have an account? Register

                                • Login or register to search.
                                • First post
                                  Last post
                                0
                                • Categories
                                • Recent
                                • Tags
                                • Popular
                                • World
                                • Users
                                • Groups