removes newlines from textfiles

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • doornx
    Confirmed User
    • Nov 2003
    • 2531

    #1

    removes newlines from textfiles

    Hmm..since this isn't an "i'd hit it" thread i'm not expecting to win an xbox for the longest thread of the week

    I have a dozen files and want to remove the newline (enter)
    from them all..not by hand but batch wise

    The newline is also the /n code but i can't seach/replace it for some reason since it somehow search for the exact same /n in the text

    Would appreciate it if someone knows an editor/prog who can do this

    ( i can't code for shit so that won't be an option )
    Send me a PM for design work
  • FuqALot
    Confirmed User
    • Dec 2001
    • 3817

    #2
    #!/usr/bin/perl
    print "Content-type:text/html\n\n";
    open(filex,"yourtextfile.txt");
    @textfile = <filex>;
    close(filex);
    foreach $linex (@textfile) {
    chomp($linex);
    push(@text,$linex);
    }
    open(filex,">textfile.txt");
    print filex @text;
    close(filex);

    quote the post if the code is looking funny.
    something like this.
    Last edited by FuqALot; 07-17-2004, 05:19 AM.

    Comment

    • doornx
      Confirmed User
      • Nov 2003
      • 2531

      #3
      k thanks..i'll try something in perl or php since i couldn't find a regular editor who can do this strangely enough
      Send me a PM for design work

      Comment

      • Adultnet
        Confirmed User
        • Sep 2003
        • 8713

        #4
        Originally posted by doornx
        k thanks..i'll try something in perl or php since i couldn't find a regular editor who can do this strangely enough
        good luck


        TrafficCashGold Paying Webmasters Since 1996!

        Awesome Conversions! Fast Weekly Payments! Over 125 Tours!

        Comment

        • Robertf
          Confirmed User
          • Feb 2004
          • 392

          #5
          Editplus

          You can use regular expression to ... search and replace
          ....

          Comment

          • doornx
            Confirmed User
            • Nov 2003
            • 2531

            #6
            Originally posted by Robertf
            Editplus

            You can use regular expression to ... search and replace
            k checking it out thanks
            Send me a PM for design work

            Comment

            • doornx
              Confirmed User
              • Nov 2003
              • 2531

              #7
              Originally posted by Robertf
              Editplus

              You can use regular expression to ... search and replace
              damn it works

              thanks
              Send me a PM for design work

              Comment

              • Robertf
                Confirmed User
                • Feb 2004
                • 392

                #8
                Originally posted by doornx
                damn it works

                thanks
                You're welcome
                ....

                Comment

                • sweet7
                  Confirmed User
                  • May 2003
                  • 1792

                  #9
                  Originally posted by Robertf
                  Editplus

                  You can use regular expression to ... search and replace
                  ICQ: 282814268

                  Comment

                  Working...