LinuxQuestions.org
Visit Jeremy's Blog.
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 12-08-2011, 04: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, 05:20 AM   #2
corp769
LQ Guru
 
Registered: Apr 2005
Location: /dev/null
Posts: 5,818

Rep: Reputation: 1007Reputation: 1007Reputation: 1007Reputation: 1007Reputation: 1007Reputation: 1007Reputation: 1007Reputation: 1007
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, 05: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, 05:30 AM   #4
corp769
LQ Guru
 
Registered: Apr 2005
Location: /dev/null
Posts: 5,818

Rep: Reputation: 1007Reputation: 1007Reputation: 1007Reputation: 1007Reputation: 1007Reputation: 1007Reputation: 1007Reputation: 1007
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, 05: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, 05:53 AM   #6
corp769
LQ Guru
 
Registered: Apr 2005
Location: /dev/null
Posts: 5,818

Rep: Reputation: 1007Reputation: 1007Reputation: 1007Reputation: 1007Reputation: 1007Reputation: 1007Reputation: 1007Reputation: 1007
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, 10:26 AM   #7
unSpawn
Moderator
 
Registered: May 2001
Posts: 29,415
Blog Entries: 55

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



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

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

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