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

Add some text after every word in a notepad

Discussion in 'BlackHat Lounge' started by Jared255, Oct 9, 2009.

  1. Jared255

    Jared255 Jr. Executive VIP Jr. VIP Premium Member

    Joined:
    May 10, 2009
    Messages:
    1,958
    Likes Received:
    1,776
    Location:
    Boston, MA
    So I have a list like this...

    word1
    word2
    word3
    word4

    in a notepad file, I want to add a word to the end of each word. so I want to transform it into

    word1newword
    word2newword
    word3newword
    word4newword

    etc.

    How can I do this?

    EDIT: Forgot add that I have a ton of words, close to 50k, so anything manual wouldn't work.
     
    Last edited: Oct 10, 2009
  2. SupraFast

    SupraFast Junior Member

    Joined:
    Jun 24, 2009
    Messages:
    151
    Likes Received:
    34
    copy and paste?
     
    • Thanks Thanks x 1
  3. Jared255

    Jared255 Jr. Executive VIP Jr. VIP Premium Member

    Joined:
    May 10, 2009
    Messages:
    1,958
    Likes Received:
    1,776
    Location:
    Boston, MA
    50,000 times? No thanks lol. Anyone else?
     
  4. theleanhorse

    theleanhorse Junior Member

    Joined:
    Sep 19, 2009
    Messages:
    124
    Likes Received:
    21
    Write a PHP script - just load up the list, split it at every slash n and then add the word and output it back out.

    You could also do it in Dreamweaver. You could do it with the find and replace as it will take regular expressions in it.

    I'm not an expert at Excel but I bet you could write a macro in Excel.
     
    • Thanks Thanks x 1
  5. LadRak

    LadRak Registered Member

    Joined:
    Jun 11, 2009
    Messages:
    99
    Likes Received:
    79
    Occupation:
    Student
    Location:
    Europe
    Something like
    Code:
    #include <iostream>
    #include <fstream>
    #include <string>
    
    using namespace std;
    
    int main ()
    {
    string line;
    string word = "the word I want to add";
    ifstream textfile ("textfile.txt");
    
    if (textfile.is_open())
    {
         while (! textfile.eof())
              {
                  getline (textfile, line);
                  line += word;
               }
         textfile.close();
    }
    
    return 0;
    }
    
    I think this works, and I hope it helps.
     
    • Thanks Thanks x 1
    Last edited: Oct 10, 2009
  6. nirmar

    nirmar Regular Member

    Joined:
    Jul 23, 2009
    Messages:
    284
    Likes Received:
    110
    Copy the contents of your notepad in Excel, Column A.
    Add your newwords in Column B.
    Now concatenate the contents of Column A and Column B in Column C.
    Column C1 = concatenate(A1,B1)
    and now copy the formula to the end of contents.

    Copy the contents of Column C to new notepad.

    Hope it works.
    If not send me the file I will do it.
     
    • Thanks Thanks x 3
  7. Gman2160

    Gman2160 Junior Member

    Joined:
    Nov 24, 2008
    Messages:
    129
    Likes Received:
    33
    Location:
    USA
    Is the "newword" the same every time, or is it newword1, newword2, newword3, etc.? If it is the same every time, or at least many times, you could just do a "find and replace"...:find "word1"..."replace" with "word1newword". If newword is different every time it'd be a bitch.
     
    • Thanks Thanks x 1
  8. SupraFast

    SupraFast Junior Member

    Joined:
    Jun 24, 2009
    Messages:
    151
    Likes Received:
    34
    I made something for your if you're interested. I PMed you.
     
  9. warrior skunk

    warrior skunk Newbie

    Joined:
    Sep 1, 2009
    Messages:
    45
    Likes Received:
    25
    You could still try a find and replace even if they are not the same word.

    find: \n
    replace with: whateveryouwantadded\n

    This will work in my linux text editors and I think it will work with your notepad
     
  10. Jared255

    Jared255 Jr. Executive VIP Jr. VIP Premium Member

    Joined:
    May 10, 2009
    Messages:
    1,958
    Likes Received:
    1,776
    Location:
    Boston, MA
    Thanks for all your replies. I used Supra's program and it worked like a charm. Mods can close this thread.