LinuxQuestions.org
Help answer threads with 0 replies.
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 12-08-2011, 05:58 AM   #1
livesimple
LQ Newbie
 
Registered: Dec 2011
Posts: 7

Rep: Reputation: Disabled
SED command


How to display unique words only once from a input file using unix command?
Example input file is having below contents:

pulseaudio
pulseaudio-esound-compat
pulseaudio-module-bluetooth
php5
php5-cli
php5-common
php5-gd
python2.6
python2.6-minimal
python-appindicator
python-apport
python-apt

I want output as
pulseaudio
php5
python2.6
 
Old 12-08-2011, 06:20 AM   #2
corp769
LQ Guru
 
Registered: Apr 2005
Posts: 5,817

Rep: Reputation: 1002Reputation: 1002Reputation: 1002Reputation: 1002Reputation: 1002Reputation: 1002Reputation: 1002Reputation: 1002
Hello,

First, read the man page on sort.
Code:
man sort
I want you to read it and understand what I am doing here......
Code:
sort -u -t- -k1,1 filename
Cheers,

Josh
 
Old 12-08-2011, 06:28 AM   #3
livesimple
LQ Newbie
 
Registered: Dec 2011
Posts: 7

Original Poster
Rep: Reputation: Disabled
Quote:
Originally Posted by corp769 View Post
Hello,

First, read the man page on sort.
Code:
man sort
I want you to read it and understand what I am doing here......
Code:
sort -u -t- -k1,1 filename
Cheers,

Josh
while executing above command im getting error: sort: multi-character tab `-k1,1'
 
Old 12-08-2011, 06:30 AM   #4
corp769
LQ Guru
 
Registered: Apr 2005
Posts: 5,817

Rep: Reputation: 1002Reputation: 1002Reputation: 1002Reputation: 1002Reputation: 1002Reputation: 1002Reputation: 1002Reputation: 1002
I'm not... How are you running it? Have you tried exactly copying what I gave you and pasting it into your terminal?
 
Old 12-08-2011, 06:50 AM   #5
livesimple
LQ Newbie
 
Registered: Dec 2011
Posts: 7

Original Poster
Rep: Reputation: Disabled
Quote:
Originally Posted by corp769 View Post
I'm not... How are you running it? Have you tried exactly copying what I gave you and pasting it into your terminal?
ya thanks alot..
Its running perfectly.
 
Old 12-08-2011, 06:53 AM   #6
corp769
LQ Guru
 
Registered: Apr 2005
Posts: 5,817

Rep: Reputation: 1002Reputation: 1002Reputation: 1002Reputation: 1002Reputation: 1002Reputation: 1002Reputation: 1002Reputation: 1002
Awesome..... Could you mark your thread as solved using the thread tools located at the top of the page, and give rep if required? Thanks!

Cheers,

Josh
 
Old 12-08-2011, 11:26 AM   #7
unSpawn
Moderator
 
Registered: May 2001
Posts: 29,361
Blog Entries: 55

Rep: Reputation: 3547Reputation: 3547Reputation: 3547Reputation: 3547Reputation: 3547Reputation: 3547Reputation: 3547Reputation: 3547Reputation: 3547Reputation: 3547Reputation: 3547
Moved: This thread is more suitable in the Linux Newbie forum and has been marked "solved" and moved accordingly. Your other question was given its own thread here: http://www.linuxquestions.org/questi...ubuntu-917755/.
 
  


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
sed command help tekmann33 Linux - Newbie 1 10-20-2008 05:06 PM
how to use sed command raghuvamsi Linux - General 2 06-26-2008 02:17 AM
sed command shyamdey Programming 2 08-30-2006 12:06 AM
sed command ancys Programming 2 08-05-2006 11:50 AM
sed command linuxdev Linux - Newbie 9 02-24-2004 05:50 PM

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

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