There's no such thing as a stupid question, but they're the easiest to answer.
JoinTour
Login
 
Tag Cloud
acer black screen blue screen boot computer connection crash css dell display driver drivers email error firefox firefox 3 game hard drive internet internet explorer itunes laptop lcd linux malware monitor network networking outlook outlook 2003 outlook express partition password printer problem problems ram router security slow software sound sprtcmd.exe trojan usb virus vista windows windows xp wireless
UNIX/Linux
Search
Search in:
 
Advanced Search
Tech Support Guy Forums > Operating Systems > UNIX/Linux >
grep html file


HELLO AND WELCOME! Before you can post your question, you'll have to register -- it's completely free! Click here to join today! We highly recommend that you print a copy of our Guide for New Members. Enjoy!

Closed Thread
 
Thread Tools
htpw16's Avatar
Member with 73 posts.
 
Join Date: Jul 2002
09-Mar-2004, 08:25 PM #1
grep html file
Hello all,

I ve got a question about using grep on the bourne shell. Im trying to grep the "title" of an html page. I got to the point where when I grep it shows some thing like

<title> Welcome </title>.

however, I simply want to extract only the "Welcome" phrase.

Any help is appreciated


Thanks
Whiteskin's Avatar
Distinguished Member with 2,051 posts.
 
Join Date: Nov 2002
Location: Alberta, Canada
Experience: Windows: Decent. Unix/Linux: Advanced +1
09-Mar-2004, 09:53 PM #2
Learn perl. Its the best way to deal with regex. That and you can acess external functions.
Squashman's Avatar
Distinguished Member with 12,699 posts.
 
Join Date: Apr 2003
Location: 1265 Lombardi Ave
09-Mar-2004, 10:49 PM #3
I am sure there are easier ways of doing this but this worked for me

grep -i title index.html | cut -f2 -d "<" | cut -f2 -d ">"

or

grep -i title index.html | sed -e 's/<TITLE>//gi' | sed -e 's/<\/title>//gi'

Last edited by LwdSquashman : 09-Mar-2004 11:01 PM.
Closed Thread

THIS THREAD HAS EXPIRED.
Are you having the same problem? We have volunteers ready to answer your question, but first you'll have to join for free. Need help getting started? Check out our Welcome Guide.


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
WELCOME TO TECH SUPPORT GUY! Are you looking for the solution to your computer problem? Join our site today to ask your question -- for free! Our site is run completely by volunteers who help people like you solve computer problems. See our Welcome Guide to get started.



Thread Tools


You Are Using:
Server ID
Advertisements do not imply our endorsement of that product or service.
All times are GMT -4. The time now is 09:51 AM.
Copyright © 1996 - 2008 TechGuy, Inc. All rights reserved.
Powered by vBulletin, Copyright © 2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.1.0
Powered by Cermak Technologies, Inc.