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

Quick question...

Discussion in 'Black Hat SEO' started by blasterpro, Jan 24, 2009.

  1. blasterpro

    blasterpro Registered Member

    Joined:
    Jan 8, 2009
    Messages:
    66
    Likes Received:
    21
    I have a list in a text file that has over 72,000 lines. I want insert {" before and "} after each line what is the quickest and easiest way to achieve this?

    Thanks in advance
     
  2. Arthas

    Arthas BANNED BANNED

    Joined:
    Jan 5, 2009
    Messages:
    637
    Likes Received:
    322
    i can code a script to do it for you. please pm me with offer.
     
  3. 4alllifestyles

    4alllifestyles Junior Member

    Joined:
    Dec 3, 2008
    Messages:
    170
    Likes Received:
    98
    In Linux Bash

    Save the following in a file named myshellscript.sh

    Code:
    while read lineoftext
    do
    echo "beforetext" "$lineoftext" "aftertext" >>resultfile.txt
    done
    Then from the commandline execute the command with:

    Code:
    cat fileyouwanttoedit.txt | sh ./myshellscript.sh
    When it finishes the resultfile.txt is your edited file and your original file is untouched just in case you typo'd and need to do it again.
     
    • Thanks Thanks x 1
  4. Arthas

    Arthas BANNED BANNED

    Joined:
    Jan 5, 2009
    Messages:
    637
    Likes Received:
    322

    you bastard
     
  5. noidea

    noidea Junior Member

    Joined:
    Oct 1, 2008
    Messages:
    108
    Likes Received:
    34
    4alllifestyles great spirit in helping someone out in BHW this is what this forum is about:D
     
  6. jinjangjoe

    jinjangjoe Newbie

    Joined:
    Jan 14, 2009
    Messages:
    34
    Likes Received:
    6
    Location:
    New York, NY
    If you are not a freetard want to do it in Windows, save the following as a vbs file (say a.vbs).

    Then from the command prompt run "cscript a.vbs {your file}". To redirect outpu another file: ""cscript a.vbs {your file} > {output file}"

    Code:
    Option Explicit
    Dim oFSO, sFile, oFile, sText
    Set oFSO = CreateObject("Scripting.FileSystemObject")
    sFile = WScript.Arguments(0)
    If oFSO.FileExists(sFile) Then
    Set oFile = oFSO.OpenTextFile(sFile, 1)
     Do While Not oFile.AtEndOfStream
      sText = oFile.ReadLine
       If Trim(sText) <> "" Then
        WScript.Echo "{" & sText & "}"
       End If
     Loop
    oFile.Close
    Else
    WScript.Echo "File not found."
    End If
     
    • Thanks Thanks x 1