Hi,
I have a file containing emails about some issues.
Using a bourne shell script, I need to extract the issue number from the URL's contained in the file (all URL's look like this :
http://www.openoffice.org/issues/show_bug.cgi?id=1881) and then print out the issue number, status and resolution on the same line, such as:
10797 Closed Fixed
1881 Started (this one has no resolution)
787 Resolved Later
....
I need a single space between each word, no tabs.
I used echo and printf, but never succeed. I usually only get the Status and Resolution, or the ID on one line and the rest on another line.
The script is ran on solaris 5.8 as such: script.sh mail.input (data file, see attachment)
Could anyone give me a clue please?
Thank you!
here's my code:
#!/bin/sh
LIST_OF_URLS=`grep 'http://.*/show_bug.cgi' $1 | tr -d [=\>=][:blank:]| sort | uniq`
for URL in $LIST_OF_URLS
do
PAGE_TEXT=`lynx -dump $URL`
THIS_ID=`echo "$URL" | nawk -F 'id=' '{print $2}'`
STATUS=`echo "$PAGE_TEXT" | grep ']Status:' | tr -d [:lower:][:digit:][=[=][=]=][=:=] | nawk -F ' ' '{print $2}'`
RESOLUTION=`echo "$PAGE_TEXT" | grep ']Resolution:' | nawk -F '\[' '{print $2}' | tr -d [:lower:][:digit:][=[=][=]=][=:=] | nawk -F ' ' '{print $2}'`
echo $THIS_ID $STATUS $RESOLUTION
done