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://">Test</a>
<a href="mms://">
<img src="images/flexplayer.jpg" title="Test TV" width="25" height="25" border="0"> </a><font color="#FFCC66">
<a href="mms://">
<img src="images/flexplayer.jpg" alt="" title="Test TV" width="25" height="25" border="0"></a>
<font color="#FFCC66"><a href="mms://">
<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:


Thanks in advance
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
Forum Moderator
Posts: 9275
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.

Code: Select all

HIDDEN=`date '+%s'`
TIME=`date '+%Y%m%d'`

curl --cookie-jar cjar --output /dev/null ''

curl --cookie cjar --cookie-jar cjar --data 'amember_login='${NAME} --data 'amember_pass='${PASS} --data 'login_attempt_id='${HIDDEN} --location \

curl --verbose --cookie cjar --output ~/televizia.html ''

grep -o 'mms://\-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
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