LinuxQuestions.org
Latest LQ Deal: Complete CCNA, CCNP & Red Hat Certification Training Bundle
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 09-12-2011, 11:59 AM   #1
hamraz
LQ Newbie
 
Registered: Sep 2011
Posts: 1

Rep: Reputation: Disabled
Urgent


hi
I am completely new in bash script. Here is my question. I have text file which contains list of ips and status code. I want to extract for example the ip with most successful response. How can i do it?
Thanks to all
 
Click here to see the post LQ members have rated as the most helpful post in this thread.
Old 09-12-2011, 12:47 PM   #2
thesnow
Member
 
Registered: Nov 2010
Location: Minneapolis, MN
Distribution: Ubuntu, Red Hat, Mint
Posts: 170

Rep: Reputation: 56
Can you post a sample of your text file, and what the criteria is for "most successful response"?
 
1 members found this post helpful.
Old 09-12-2011, 12:47 PM   #3
David the H.
Bash Guru
 
Registered: Jun 2004
Location: Osaka, Japan
Distribution: Debian sid + kde 3.5 & 4.4
Posts: 6,823

Rep: Reputation: 1957Reputation: 1957Reputation: 1957Reputation: 1957Reputation: 1957Reputation: 1957Reputation: 1957Reputation: 1957Reputation: 1957Reputation: 1957Reputation: 1957
Don't use thread titles like "urgent" or "help". They aren't urgent for anyone but you, and they don't give any clue about the topic of the thread, so many people will simply ignore them. Clearly stating the problem or request in the title will give you better responses.


Now, please define your problem in more detail. What does this text file look like? How would we determine the "most successful response"? What should the output look like?

Have you done any work so far? Have you done any searches of the site or the web for similar cases?

Probably it will only require a simple grep/sed/awk command to extract the text, and perhaps some formatting/processing for the output. But the proper solution to use depends on the format of the input. So you have to give us that first.

Here are a few useful bash scripting references to get you started:
http://mywiki.wooledge.org/BashGuide
http://www.linuxcommand.org/index.php
http://mywiki.wooledge.org/BashFAQ
http://mywiki.wooledge.org/BashPitfalls
http://tldp.org/LDP/Bash-Beginners-G...tml/index.html
http://www.tldp.org/LDP/abs/html/index.html
http://www.gnu.org/software/bash/manual/bashref.html
http://wiki.bash-hackers.org/start
 
2 members found this post helpful.
Old 09-12-2011, 05:07 PM   #4
TB0ne
LQ Guru
 
Registered: Jul 2003
Location: Birmingham, Alabama
Distribution: SuSE, RedHat, Slack,CentOS
Posts: 17,956

Rep: Reputation: 3693Reputation: 3693Reputation: 3693Reputation: 3693Reputation: 3693Reputation: 3693Reputation: 3693Reputation: 3693Reputation: 3693Reputation: 3693Reputation: 3693
Quote:
Originally Posted by hamraz View Post
hi
I am completely new in bash script. Here is my question. I have text file which contains list of ips and status code. I want to extract for example the ip with most successful response. How can i do it?
Thanks to all
Sounds very much like homework to me...as David and thesnow asked, post samples of the text file, and show what work you've done thus far, and we'll be glad to help.
 
0 members found this post helpful.
Old 09-13-2011, 05:55 AM   #5
linux2001
Member
 
Registered: Sep 2011
Posts: 32

Rep: Reputation: Disabled
Quote:
Originally Posted by hamraz View Post
hi
I am completely new in bash script. Here is my question. I have text file which contains list of ips and status code. I want to extract for example the ip with most successful response. How can i do it?
Thanks to all
Can you send a sample file
you can use cat, grep, cut commands

java socket

Last edited by linux2001; 01-26-2012 at 08:32 AM.
 
Old 09-13-2011, 09:53 AM   #6
onebuck
Moderator
 
Registered: Jan 2005
Location: Midwest USA, Central Illinois
Distribution: SlackwareŽ
Posts: 12,549
Blog Entries: 23

Rep: Reputation: 1943Reputation: 1943Reputation: 1943Reputation: 1943Reputation: 1943Reputation: 1943Reputation: 1943Reputation: 1943Reputation: 1943Reputation: 1943Reputation: 1943
Hi,

OP seems to be posting homework query. Schools back from summer!
LQ Rules;
Quote:
Do not expect LQ members to do your homework - you will learn much more by doing it yourself.
FYI: Netiquette is a set of social conventions that facilitate interaction over networks, ranging from Usenet and mailing lists to blogs and forums.

FYI: I suggest that you look at 'How to Ask Questions the Smart Way' so in the future your queries provide information that will aid us in diagnosis of the problem or query.
 
  


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
boot sector and lilo collapse !!!!! URGENT URGENT URGEN !!!!! frelihm Linux - Software 21 12-02-2009 11:21 AM
how to mv the files...urgent...urgent manojkarthi Programming 2 07-02-2008 03:21 AM
Urgent Question Regarding Urgent Questions! Need Help Now! Crashed_Again LQ Suggestions & Feedback 11 10-17-2007 09:07 PM
Urgent Urgent !!!! Mozilla Keeps All Your Deleted Emails !!!! odin123 Linux - Software 2 01-31-2004 03:22 AM


All times are GMT -5. The time now is 01:23 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
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration