terminal split one line file by regex

Discussion in 'Programming/Scripts' started by kiza, Oct 4, 2011.

  1. kiza

    kiza New Member


    I wanted to create a custom made scrolling gallery on ebay for my store, however I didn't want another logo and links plastered over it like some scrub so I wanted to pull the listing off a seller aka me from the ebay store and split the file by the links to items and link to it later

    However i have been trying many regex expressions with grep and awk and i have realized, i really suck.

    Everything i try with awk and grep splits from the start of the newline which is nearly the entire page, any help is greatly appreciated, i have been using curl to get the source code for manipulation or you could just view source and check it out

    my latest attempt was:
    curl www.ebay.com.au/sch/orangeit_store/m.html?_dmd=1 | awk '/Featured Items/,EOF'

    the website is a search request by a seller id and the awk was trying to remove the junk at the start so i would only get the results, after this i was hoping to either place newlines at the start of <a tags or split by items

    I answered my own question, i was trying to do advanced stuff when i thought of a simple solution:

    sed "s/</\n</g"
    which just finds all opening tags and replaces it with a newline and puts back in the opening tag, i am sure there are much more elegant solutions, but this sets up for easy grep commands which is what i need =]
    Last edited: Oct 4, 2011

Share This Page