Loosing price variable only when assigning to variable name
- From: tpscrat@xxxxxxxxx
- Date: 15 Aug 2006 17:54:58 -0700
I have a very simple script that is just suppose to extract the price
from an html page. Seems easy...but it's giving me a headache. Script
below...
This is what seems like it should work to me... But all it does is
output a blank line with no data.
---------------------------------
#!/bin/bash -e
find . -name "test.html" | while read line;
do
PRICE=`egrep -o -m 1 '\$[0-9]+\.[0-9][0-9]' $line`;
echo $PRICE;
done
----------------------------------
You might think that the egrep is not working, but if I change it to
the following, it works! It only seems to loose the data when I assign
it to a variable name, as in the first example.
---------------------------------
#!/bin/bash -e
find . -name "test.html" | while read line;
do
egrep -o -m 1 '\$[0-9]+\.[0-9][0-9]' $line;
done
----------------------------------
I thought it may have something to do with the "$" in the price
variable trying to be echoed, so I piped it through sed to remove it
from the string before assigning, still with no luck.
Here is what is contained in "test.html"
----------------------------------
<b>Price: </b></font><font face="arial" size=2
color=cc0000>$797.90</font></td></tr>
----------------------------------
Any help someone can provide would be great!!! I don't pretend to know
if all but I thought I was better than this!
.
- Follow-Ups:
- Re: Loosing price variable only when assigning to variable name
- From: Bill Marcum
- Re: Loosing price variable only when assigning to variable name
- Prev by Date: Re: Alias to start application in background
- Next by Date: Cygwin email send mail problem
- Previous by thread: Alias to start application in background
- Next by thread: Re: Loosing price variable only when assigning to variable name
- Index(es):
Relevant Pages
|
Loading