LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   SED command (https://www.linuxquestions.org/questions/linux-newbie-8/sed-command-917709/)

livesimple 12-08-2011 05:58 AM

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

corp769 12-08-2011 06:20 AM

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

livesimple 12-08-2011 06:28 AM

Quote:

Originally Posted by corp769 (Post 4545014)
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'

corp769 12-08-2011 06:30 AM

I'm not... How are you running it? Have you tried exactly copying what I gave you and pasting it into your terminal?

livesimple 12-08-2011 06:50 AM

Quote:

Originally Posted by corp769 (Post 4545021)
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.

corp769 12-08-2011 06:53 AM

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

unSpawn 12-08-2011 11:26 AM

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/.


All times are GMT -5. The time now is 12:27 AM.