HowtoForge Forums | HowtoForge - Linux Howtos and Tutorials

HowtoForge Forums | HowtoForge - Linux Howtos and Tutorials (http://www.howtoforge.com/forums/index.php)
-   Programming/Scripts (http://www.howtoforge.com/forums/forumdisplay.php?f=7)
-   -   terminal split one line file by regex (http://www.howtoforge.com/forums/showthread.php?t=54418)

kiza 4th October 2011 02:13

terminal split one line file by regex
 
SOLVED


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 =]


All times are GMT +2. The time now is 09:33.

Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2014, vBulletin Solutions, Inc.