LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 10-31-2007, 12:39 AM   #1
stocky021
LQ Newbie
 
Registered: Feb 2006
Distribution: Suse 10
Posts: 20

Rep: Reputation: 0
bash coding


im not sure if this is the right place to post this. im doing a uni assignment, and it involves using shell scripting to copy a html file off the net, and read one line from it and print out a value. so far i have
GET http://website, and this displays the entire source code of the page in the terminal. im thinking i need to use awk to find the one line i need and to copy it to a variable, but i dont know how to go about this. can anyone help?
 
Old 10-31-2007, 05:15 AM   #2
Gethyn
Member
 
Registered: Aug 2003
Location: UK
Distribution: (X)Ubuntu 10.04/10.10, Debian 5, CentOS 5
Posts: 900

Rep: Reputation: 32
Well, you could try finding the line you're looking for using grep.
 
Old 11-01-2007, 04:28 AM   #3
bigearsbilly
Senior Member
 
Registered: Mar 2004
Location: england
Distribution: Mint, Armbian, NetBSD, Puppy, Raspbian
Posts: 3,515

Rep: Reputation: 239Reputation: 239Reputation: 239
you can use while read to go through the file,
or you can simply use grep to find the line
and use the subst expressions ${X##} ${X%%} to
chop the bits you don't want.
or use sed


get you started
 
Old 11-01-2007, 07:44 AM   #4
pixellany
LQ Veteran
 
Registered: Nov 2005
Location: Annapolis, MD
Distribution: Mint
Posts: 17,809

Rep: Reputation: 743Reputation: 743Reputation: 743Reputation: 743Reputation: 743Reputation: 743Reputation: 743
What text do they use for BASH scripting? If you are just starting, get Bash Guide for Beginners--free at http://tldp.org

As stated, grep is maybe the best way to find a line with certain content. To grab a value from that line, you need to know the structure---eg is the value always in the same place? If so, then AWK should do it (it works by fields)

Excellent tutorials on SED and AWK here: http://www.grymoire.com/Unix/
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Visual C++ coding help iqbal Programming 4 07-14-2006 04:48 PM
c coding trace bruse Linux - Newbie 2 07-13-2005 04:25 PM
Coding a WM? SocialEngineer Programming 1 05-20-2005 08:32 AM
Bash Coding Help neoific Linux - Software 1 11-11-2004 07:24 PM
html coding sachitha General 2 08-18-2004 10:14 PM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 07:24 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration