There's no such thing as a stupid question, but they're the easiest to answer.
JoinTour
Login
Search
Linux and Unix
Tag Cloud
access acer asus bios bsod computer crash driver drivers error ethernet excel freeze gaming google gpu graphics hard drive hardware hdmi internet laptop malware memory monitor motherboard mouse network printer problem ram registry router server slow software sound svchost.exe trojan usb video virus vista wifi windows windows 7 windows 7 32 bit windows 7 64 bit windows xp wireless
Search
Search for:
Tech Support Guy Forums > Operating Systems > Linux and Unix >
grep html file

Reply  
Thread Tools
htpw16's Avatar
Member with 73 posts.
 
Join Date: Jul 2002
09-Mar-2004, 09: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
Senior Member with 2,051 posts.
 
Join Date: Nov 2002
Location: Alberta, Canada
Experience: Windows: Decent. Unix/Linux: Advanced +1
09-Mar-2004, 10:53 PM #2
Learn perl. Its the best way to deal with regex. That and you can acess external functions.
Squashman's Avatar
Trusted Advisor with 18,705 posts.
 
Join Date: Apr 2003
Location: 1265 Lombardi Ave
Experience: Bocks of Rox
09-Mar-2004, 11: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; 10-Mar-2004 at 12:01 AM..
Reply

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.

Search Tech Support Guy

Find the solution to your
computer problem!




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 want to help you solve your computer problems. See our Welcome Guide to get started.
Thread Tools



Facebook Facebook Twitter Twitter TechGuy.tv TechGuy.tv Mobile TSG Mobile
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 04:25 AM.
Copyright © 1996 - 2011 TechGuy, Inc. All rights reserved.

Powered by Cermak Technologies, Inc.