View Single Post
Old 4th October 2011, 02:13
kiza kiza is offline
Junior Member
Join Date: Oct 2011
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Default terminal split one line file by regex


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 | 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 by kiza; 4th October 2011 at 03:52. Reason: SOLVED
Reply With Quote
Sponsored Links