
January 22nd, 2004, 11:25 AM
|
|
Registered User
|
|
Join Date: Nov 2003
Posts: 16
Time spent in forums: 10 m 59 sec
Reputation Power: 0
|
|
|
Using sed on grep results...
I am trying to get some information from a load of different files (using grep) and then cut some of the information from it with sed. Unfortunately I know smeg all about sed and was wondering if you could help....
Basically the script looks like ...
Quote:
#!/usr/local/bin/bash
line2="http://www.myurl.com"
dom_folder="domain/"
line3="http://some.other.com"
DB="test"
grepline="domain/some.other.com/index.php?category=new:<img src=http://some.other.com/p.gif width=1 height=17><a href=http://www.myurl.com/ class=linkCat target=_blank>Blah blah blah blah...</a><br>"
grep -iRs "<a href=${line2}" $dom_folder${line3#*/\/}/* | sed -e 's/^\(.*\)$/ UPDATE results set page='\1/' where url='${line3}'' | psql $DB
|
The grepline is the results of the grep (obviously!) and what I need is the "index.php?category=new" bit...so I guess its a case of stripping up to the some.other.com and deleting everything after the ":". I need to put that page into a db, usually I use echo but amn't too sure if that'll work here.
At the moment when I run it all I get is...
Quote:
[bash]#./blah.bash
sed: here url=http://some.other.com: No such file or directory
[bash]# |
Any help gratefully appreciated!!
|