LinuxQuestions.org
Visit Jeremy's Blog.
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 03-25-2008, 08:10 AM   #1
marhen
LQ Newbie
 
Registered: Mar 2008
Location: Tangerang, Indonesia
Distribution: Fedora Core 6
Posts: 19

Rep: Reputation: 0
Need bash script to get string from file


I need a bash script to get strings from a text that created from this command :

top > file

i need to get the cpu(s) % values

command :

free > file2

i need to get the used, free, and available value

command :

df > file3

i need to get the used, free, and available value

All values are going to be save to another text file (file --> newfile.txt, file2 --> newfile2.txt, file3 --> newfile3.txt) that contains the extracted values so PHP on windows can read it and save them to databases.

or

All values are directly saved to databases.

Please, i'm still newbie to linux and bash scripting, and i still pursuing my study. This is for my final exam.
 
Old 03-25-2008, 08:25 AM   #2
acid_kewpie
Moderator
 
Registered: Jun 2001
Location: UK
Distribution: Gentoo, RHEL, Fedora, Centos
Posts: 43,398

Rep: Reputation: 1963Reputation: 1963Reputation: 1963Reputation: 1963Reputation: 1963Reputation: 1963Reputation: 1963Reputation: 1963Reputation: 1963Reputation: 1963Reputation: 1963
if this is for an exam, then it is up to you to work this out for yourself. for a "final" exam it's not rocket surgery.
 
Old 03-25-2008, 09:01 AM   #3
Nathanael
Member
 
Registered: May 2004
Location: Karlsruhe, Germany
Distribution: debian, gentoo, os x (darwin), ubuntu
Posts: 940

Rep: Reputation: 32
it does sound oddly like homework or something...

but how about you at least provide what you already have so we can look at that - if you think we are going to do all the work for you - you can knock that right out of your mind :-P
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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
Parse String in a Bash script jimwelc Linux - Newbie 8 11-09-2012 07:47 AM
bash script- text file manip- delete everything before/after string justin99 Programming 8 05-15-2009 07:40 PM
help with bash script: remove * to the last . in string drkstr Linux - Software 3 04-25-2006 04:54 PM
String manipulation with BASH script King V Programming 9 04-21-2006 03:15 PM
looking for string on particular line - bash script tara Linux - General 9 12-14-2005 05:43 PM


All times are GMT -5. The time now is 11:09 PM.

Main Menu
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
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration