LinuxQuestions.org
Latest LQ Deal: Latest LQ Deals
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 01-09-2012, 08:24 PM   #1
hosney00ux
LQ Newbie
 
Registered: Jul 2009
Location: Egypt
Posts: 13

Rep: Reputation: 0
select compination uniq using shell script


hi all,

Code:
[STUCK] ExecuteThread: '400'
[STUCK] ExecuteThread: '500' 
[STUCK] ExecuteThread: '400'
[STUCK] ExecuteThread: '300'
[STUCK] ExecuteThread: '400'
[STUCK] ExecuteThread: '500'
[STUCK] ExecuteThread: '300'
[STUCK] ExecuteThread: '200'
[STUCK] ExecuteThread: '200'
how to select unique from the log file using this compination
{[STUCK] ExecuteThread: '200'}
to get this result

Code:
[STUCK] ExecuteThread: '400'
[STUCK] ExecuteThread: '500' 
[STUCK] ExecuteThread: '300'
[STUCK] ExecuteThread: '200'
 
Old 01-09-2012, 09:09 PM   #2
lyle_s
Member
 
Registered: Jul 2003
Distribution: Slackware
Posts: 392

Rep: Reputation: 55
If you have the "[STUCK]" lines in a file called 'input':


Code:
sort input | uniq
Lyle.
 
Old 01-10-2012, 01:18 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
"sort -u" alone can be used instead of "sort | uniq". At least as long as you're using the gnu coreutils.

sort is quite a complex and powerful tool, BTW. I recommend reading its info page (info sort) when you have a chance.
 
Old 01-10-2012, 03:32 AM   #4
hosney00ux
LQ Newbie
 
Registered: Jul 2009
Location: Egypt
Posts: 13

Original Poster
Rep: Reputation: 0
the idea is how to select this compination from a file
and this fields is not in the same column to cut is
 
  


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
[SOLVED] Randomly select a folder using Shell Scripting kapz_unlocked Linux - Newbie 7 06-21-2011 01:02 AM
Executing a Shell script with 654 permissions inside another shell script. changusee2k Linux - Newbie 2 06-07-2011 08:58 PM
How to select a shell dynamically drkdick Linux - Security 2 10-06-2009 12:54 AM
need a shell script to select a random image frieza Linux - General 1 05-14-2008 05:04 AM

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

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