#1
  1. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jun 2011
    Posts
    61
    Rep Power
    9

    Screen Scraping ?


    Id like to go through a text file and put any line starting with a certain word into and array to be worked on later. For instance:

    Jon has a car
    Jon has a boat
    Jon has a home

    Id like to grab every line starting with jon, put them to arrays and tag element 3 and put it to variables to be used later. So in this case I would want car, boat and home.

    Just trying to get my hands around some better practices for screen scraping using Perl. I have an existing program that works great but I hard coded in the elements I want to tag data in. Ive seen it fail, albeit once in over 500 reps, because with that method if anything on the screen changes I will tag the wrong thing. Im thinking if I parse through the master array/file and get only the lines that begin with a certain word it will be much safer and more reliable.
  2. #2
  3. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jun 2011
    Posts
    61
    Rep Power
    9
    OK I figured out the first part but what if you want every line left in your array after a certain word or number? For instance:

    My name is jon and I work on cars
    Ive been a mechanic since I was 18

    Years old and am one of the best in
    the business.

    Lets say I want everything after Years, including the next line, in the same scalar for tagging. Is this possible?

IMN logo majestic logo threadwatch logo seochat tools logo