1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Convert Line Break Into Comma?

Discussion in 'BlackHat Lounge' started by lewi, Sep 11, 2010.

  1. lewi

    lewi Jr. VIP Jr. VIP Premium Member

    Joined:
    Aug 5, 2008
    Messages:
    2,309
    Likes Received:
    818
    Hey,

    Have a huge keyword list of like 20,000 words and need to convert them into keyword1,keyword2,keyword3 etc format

    Currently they look like this...

    keyword1
    keyword2
    keyword3

    Now had a bot made for me but it keeps stalling even with 4gb ram and 6ghz server and that is only with like 1/8th of the list (takes a while to cut it down smaller and will take even longer to put it all back together).

    So anyone got any ideas?

    I tried notepad find and replace as that is quick but cannot turn a line break into a comma unfortunately (or can you?)

    Thanks

    Lewi
     
  2. blacat

    blacat Regular Member

    Joined:
    Dec 8, 2009
    Messages:
    457
    Likes Received:
    147
    Location:
    DownWorld
    Have you tried excel?
     
  3. lewi

    lewi Jr. VIP Jr. VIP Premium Member

    Joined:
    Aug 5, 2008
    Messages:
    2,309
    Likes Received:
    818
    I have only tried notepad and pasting them into this bot this guy made for me!

    Even notepad takes like 5 minutes to load it up so excel will probably take a lot longer and crash!

    But how would you do it with excel?

    Lewi
     
  4. HoNeYBiRD

    HoNeYBiRD Jr. VIP Jr. VIP

    Joined:
    May 1, 2009
    Messages:
    5,882
    Likes Received:
    7,122
    Gender:
    Male
    Occupation:
    Geographer, Tourism Manager
    Location:
    Ghosted
    check out this thread:
    Code:
    http://www.blackhatworld.com/blackhat-seo/white-hat-seo/153028-how-convert-carriage-return-comma-separated-keyword-list.html
    or this:
    Code:
    http://www.blackhatworld.com/blackhat-seo/black-hat-seo/197421-convert-row-into-comma-separated-list.html
     
    • Thanks Thanks x 1
  5. blacat

    blacat Regular Member

    Joined:
    Dec 8, 2009
    Messages:
    457
    Likes Received:
    147
    Location:
    DownWorld
    In excel it is pretty easy to convert column to rows. You highlight the values and then copy.

    Right click and choose paste special.

    Make sure you tick Transpose.

    That's it.

    After that you just save it in whatever file format that you want.
     
  6. MaDeuce

    MaDeuce Newbie

    Joined:
    Oct 24, 2008
    Messages:
    45
    Likes Received:
    16
    Location:
    Austin, TX
    Looks like you are on windows. If you have a linux machine, it's trivial:

    Code:
    tr '\n' , < infile > outfile
    Where 'infile' is your file with the newlines and outfile is the file with the commas in place of newlines.

    If your file was created on windows, it actually contains both a newline and a carriage return. If you need to drop the carriage return in addition to the substitution:

    Code:
    tr '\n' , < infile | tr -d '\r' > outfile
    Note that the resulting file will only have a single line in it. This may or may not be what you want. If you have thousands of keywords, it probably isn't. It's easy to fix, but no point in showing you how unless you can't use just the single line.
     
  7. Tinus

    Tinus Registered Member

    Joined:
    Mar 4, 2009
    Messages:
    54
    Likes Received:
    19
    I had the same problem with something similar, but it's the same solution.

    Open the file in microsoft words. press ctr+h, then find: "^p" & replace by: ","
     
    • Thanks Thanks x 1
    Last edited: Sep 17, 2010
  8. nixnash

    nixnash Power Member

    Joined:
    Oct 26, 2009
    Messages:
    581
    Likes Received:
    204
    Occupation:
    Student
    Location:
    BHW
    okay here is a little php script which i wrote for you , this might help.

    Code:
    <?php
    set_time_limit(0);
    $myfile = 'your txt file name';//place this txt file in same directory as the php code.
    $lines = file($myfile);   
    for($i=count($lines);$i>0;$i--)
    //for($i=100;$i>0;$i--) //if you need to get first 100 words
    {
        echo "$lines[$i],";    
    }
    
    ?>
    Hit thanks if you find this helpful.
     
  9. deathclick

    deathclick Junior Member

    Joined:
    Aug 9, 2010
    Messages:
    131
    Likes Received:
    55
    Location:
    San Jose, California
    Download Textpad. It's free. It is a text editor like notepad, but it also has regular expressions like Linux. After pasting in your data, select Replace under the Search Tab, check Regular Expression in the box, and put \n in the Find What field (\n is the regular expression for line break) and put , in the Replace with field, hit Replace All and you are done.

    Textpad is very useful and I use it all the time.