Regular expresion and grep

A 5 star hangout for overworked and underpaid system admins.

Regular expresion and grep

Postby tupi » 2012/12/22 18:41:59

Hello folks,
I'm working on a nobody project (just learn bash scripting) and I don't have any idea how to grep only this particular string in BASH:

Code: Select all
<td width="242" bgcolor="#F3F3F3"><font color="#FFCC66">
<font color="#FFCC66"> <a href="mms://video.test.com/onlineTV?token=fb26943212f13366a246880c01f5e9fa">Test</a>
<a href="mms://video1.test.com/onlineTV?token=fb26943212f13366a246880c01f5e9fa">
<img src="images/flexplayer.jpg" title="Test TV" width="25" height="25" border="0"> </a><font color="#FFCC66">
<a href="mms://video2.test.com/onlineTV?token=fb26943212f13366a246880c01f5e9fa">
<img src="images/flexplayer.jpg" alt="" title="Test TV" width="25" height="25" border="0"></a>
<font color="#FFCC66"><a href="mms://vide3.test.com/onlineTV?token=fb26943212f13366a246880c01f5e9fa">
<img src="images/flexplayer.jpg" alt="" title="Test" width="25" height="25" border="0"> </a><font color="#FFCC66">
<font color="#FFCC66"><font color="#FFCC66"></td>

Result to be:

mms://video.test.com/onlineTV?token=fb26943212f13366a246880c01f5e9fa



Thanks in advance
tupi
 
Posts: 11
Joined: 2009/03/01 13:59:33
Location: Toronto,Canada

Regular expresion and grep

Postby AlanBartlett » 2012/12/22 22:16:28

Moved to Social as this is not a CentOS related query.
User avatar
AlanBartlett
Forum Moderator
 
Posts: 8975
Joined: 2007/10/22 11:30:09
Location: ~/Earth/UK/England/Suffolk

Re: Regular expresion and grep

Postby tupi » 2012/12/23 17:37:01

Ah... I'm so sorry Alan.
I want to share my script dumping a remotely mms file string into the local server.
Regards

Code: Select all
#!/bin/bash

NAME='loginName'
PASS='loginPass'
HIDDEN=`date '+%s'`
TIME=`date '+%Y%m%d'`

curl --cookie-jar cjar --output /dev/null 'http://www.djtacho.com/member/plugins/protect/new_rewrite/login.php?v=-any&url=/members/'

curl --cookie cjar --cookie-jar cjar --data 'amember_login='${NAME} --data 'amember_pass='${PASS} --data 'login_attempt_id='${HIDDEN} --location \
'http://www.djtacho.com/member/plugins/protect/new_rewrite/login.php?v=-any&url=/members/'

curl --verbose --cookie cjar --output ~/televizia.html 'http://www.djtacho.com/members/televizia.php'

grep -o 'mms://video.djtacho.com/onlineBTV\-hq?token=[a-zA-Z0-9]*' televizia.html  > tvFile.txt

while read line; do
   mplayer -dumpstream -dumpfile ${TIME}.wmv $line # or whaterver you want to do with the $line variable
    sleep 300
done < tvFile.txt
tupi
 
Posts: 11
Joined: 2009/03/01 13:59:33
Location: Toronto,Canada


Return to CentOS Social

Who is online

Users browsing this forum: No registered users and 0 guests