LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Home Forums Tutorials Articles Register
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, 10: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, 11:47 AM   #2
thesnow
Member
 
Registered: Nov 2010
Location: Minneapolis, MN
Distribution: Ubuntu, Red Hat, Mint
Posts: 172

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, 11:47 AM   #3
David the H.
Bash Guru
 
Registered: Jun 2004
Location: Osaka, Japan
Distribution: Arch + Xfce
Posts: 6,852

Rep: Reputation: 2037Reputation: 2037Reputation: 2037Reputation: 2037Reputation: 2037Reputation: 2037Reputation: 2037Reputation: 2037Reputation: 2037Reputation: 2037Reputation: 2037
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, 04:07 PM   #4
TB0ne
LQ Guru
 
Registered: Jul 2003
Location: Birmingham, Alabama
Distribution: SuSE, RedHat, Slack,CentOS
Posts: 26,617

Rep: Reputation: 7963Reputation: 7963Reputation: 7963Reputation: 7963Reputation: 7963Reputation: 7963Reputation: 7963Reputation: 7963Reputation: 7963Reputation: 7963Reputation: 7963
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, 04: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 07:32 AM.
 
Old 09-13-2011, 08:53 AM   #6
onebuck
Moderator
 
Registered: Jan 2005
Location: Central Florida 20 minutes from Disney World
Distribution: SlackwareŽ
Posts: 13,923
Blog Entries: 44

Rep: Reputation: 3158Reputation: 3158Reputation: 3158Reputation: 3158Reputation: 3158Reputation: 3158Reputation: 3158Reputation: 3158Reputation: 3158Reputation: 3158Reputation: 3158
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



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

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 06:42 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