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

Need to add a word after each line in a text file.

Discussion in 'BlackHat Lounge' started by RedKiller, Dec 24, 2010.

  1. RedKiller

    RedKiller Junior Member

    Joined:
    Oct 16, 2010
    Messages:
    183
    Likes Received:
    75
    Hello,

    I need to add a word after each line in a text file.

    Anyone knows any software that can do this ?

    Thanks alot. :plane:
     
  2. boomboomer

    boomboomer Executive VIP

    Joined:
    Feb 7, 2008
    Messages:
    705
    Likes Received:
    865
    excel, textpad ..
     
  3. JinxY

    JinxY Regular Member

    Joined:
    May 14, 2007
    Messages:
    376
    Likes Received:
    66
    Using sed:
    Code:
    sed 's/.*/&theword/' yourfile.txt
    Using awk:
    Code:
    awk '{print $0,"theword"}' yourfile.txt>newfile.txt
     
  4. Ruchka

    Ruchka Junior Member

    Joined:
    Jan 24, 2009
    Messages:
    108
    Likes Received:
    13
    import the text file into excel ("data" > "import")

    follow the step in the import wizard

    use the CONCATENATE function:

    =concatenate(cell1,cell2)

    where "cell1" is the first line of text from the text file, "cell2" is the word you want added to the end of the line. put this formula in cell3 (or wherever, but on the same row as the first line of text from your text file)

    if you want a space in front of the word you are adding, use this:

    =concatenate(cell1," ",cell2)

    "anchor" cell2 in your formula ) i.e., $A$2 for cell A2

    copy and paste downward for all your rows of text

    to get rid of the resulting formula so there is only text after combining, highlight the new column, chose "copy" then "paste special" > "values
     
  5. wrangler

    wrangler Regular Member

    Joined:
    Jun 14, 2010
    Messages:
    487
    Likes Received:
    599
    Even easier (if you have Word) - Open the file, use search-replace. Use the special character forparagraph break, and replace that with paragraph break, space, your word, and hit replace all. Save as text.
     
  6. Kudlit

    Kudlit Junior Member

    Joined:
    Jul 9, 2009
    Messages:
    145
    Likes Received:
    30
    I use Notepad ++