Jump to content

Grep - help


Mooblar
 Share

Recommended Posts

Hi, I'm building my own "Sms service" I've already configured my sms gateway, So my idea is that I wanna be able to send a sms to my gateway which then runs a script that will wget a a site (Where my teachers write what homework I should do etc), now this is where my problems is, I've found out the tags around the message like this eg. <tag>Homework</tag>. Now I want grep (or awk sed etc) to sort out the variable(homework).

So if i do a

$> cat bla.html

<tag>Do this and that</tag>

Then i want to do

$> cat | grep Some wildcard thingy (so it sorts out "Do this and that")

Do this and that

Sorry for my poor english, i'm pretty tired so i might edit it tomorrow :>

I hope you got my point ;)

Thanks!

Link to comment
Share on other sites

Then i want to do

$> cat | grep Some wildcard thingy (so it sorts out "Do this and that")

Do this and that

Hi,

After you grep the line you want, you can pipe it to sed to strip the tags:

sed -e 's/&lt;[^&gt;]*&gt;//g

I tried it with a HTML file. It takes <tag>X</tag> and leaves X.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

 Share

  • Recently Browsing   0 members

    No registered users viewing this page.

×
×
  • Create New...