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

How to extract certain lines of text from a large text file?

Discussion in 'Black Hat SEO' started by BlingBling, Feb 27, 2010.

  1. BlingBling

    BlingBling Newbie

    Joined:
    Oct 3, 2009
    Messages:
    22
    Likes Received:
    19
    Hey people I am working on a sick imacros program to release on BHW...but I need help on one thing.

    I have a huge text file with titles and short articles of content. The title lines have a delimiter character, so I know this can be accomplished. I found a program on google that does just what I want but its shareware and I cant export the results unless I figure out how to crack its ghetto registration.

    I know someone on here knows what to use for this!

    Thanks
     
  2. xiphre

    xiphre Regular Member

    Joined:
    Jun 9, 2007
    Messages:
    290
    Likes Received:
    84
    Location:
    EU
    Any php guy here could do that with regular expressions.
    Could you post a bit of the text so that I can have a look?
     
  3. BlingBling

    BlingBling Newbie

    Joined:
    Oct 3, 2009
    Messages:
    22
    Likes Received:
    19
    Sure her eyou go :D

    Code:
    " Article Title 1 is here!!!","
                
    
    
                Article content goes here. Text text text text...ectect
            
    " Article Title 2 is here!!!","
                
    
    
                Article content here,blahblah blah
    
    " Article Title 3 is here!!!","
    
    this format is repeated over and over so i hope this explains what I'm trying to do. The title lines start with a " and a space after it.
     
  4. xiphre

    xiphre Regular Member

    Joined:
    Jun 9, 2007
    Messages:
    290
    Likes Received:
    84
    Location:
    EU
    Ok, any generous php coder with an hour extra time should be able to do it for you:) Sorry I cant..
     
  5. bpaw

    bpaw Junior Member

    Joined:
    Aug 9, 2008
    Messages:
    175
    Likes Received:
    48
    Home Page:
    If you have access to a Unix/Linux machine and don't mind the command line, you can look into the "cut" command. I don't know the complexity of your file but it may be sufficient.
     
  6. kaidoristm

    kaidoristm Power Member

    Joined:
    Feb 13, 2009
    Messages:
    561
    Likes Received:
    726
    Occupation:
    Freelancer
    Location:
    Estonia
    Home Page:
    What do you exactly wish to do with it?
     
  7. keith

    keith Junior Member

    Joined:
    Jan 26, 2010
    Messages:
    177
    Likes Received:
    127
    Occupation:
    Web Development & SEO
    Location:
    Outside of Chicago
    Home Page:
    Hey, if your interested I do PHP everyday.

    I can't tell how many new lines are actually here in a quote compared to the file.

    Shoot me an email: keith@kfnwebsolutions.com

    This is a VERY easy job to do with PHP. (Hell, I could even do it with autoit lol)
     
  8. Kid Shaleen

    Kid Shaleen Regular Member

    Joined:
    Oct 29, 2009
    Messages:
    250
    Likes Received:
    63
    A generic way to do it, with the specific keystrokes depending on your text editor, would be to use two files with search and copy.

    Pseudo-code would be something like:

    begin macro
    search for beginning string
    move to beginning of found line
    turn block on
    search for ending string
    move to end of line
    turn block off
    copy block
    go to second file
    copy block
    go to end of second file
    go back to first file
    end and save macro

    then just run the macro repeatedly until you've worked your way through the first file
     
  9. BlingBling

    BlingBling Newbie

    Joined:
    Oct 3, 2009
    Messages:
    22
    Likes Received:
    19
    I'm scraping forums for posts, making the content unique, then auto posting to my forums.
     
  10. E. Fudd

    E. Fudd Newbie

    Joined:
    Sep 29, 2009
    Messages:
    42
    Likes Received:
    2
    Try a program called search and replace by funduc.

    It is an incredibly simple and complex utility for making all sorts of interesting changes to many different types of documents.

    Last week I used it to remove all of the lines in a 6 million line file that did not start with the wanted text.

    If you would like, send me a section of the file and I will see what I can do.

    I am not a UNIX/Linux person but, if you are comfortable with grep you should find this easy to use.
     
    • Thanks Thanks x 1
  11. BlingBling

    BlingBling Newbie

    Joined:
    Oct 3, 2009
    Messages:
    22
    Likes Received:
    19
    Hey thanks for your response.

    I will try out search and replace, thanks for the recommendation.

    Hope this does what I want it to and is easy to use (most important)

    edit: This program was just what I was looking for, thanks.

    Mods may close this thread if they wish. I really appreciate it very much :)
     
    Last edited: Feb 28, 2010
  12. nathanooo2

    nathanooo2 Registered Member

    Joined:
    Feb 3, 2010
    Messages:
    95
    Likes Received:
    1
    If Keith is going to do this for you I draw my hands back but if.........