Review your favorite Linux distribution.
Go Back > Forums > Linux Forums > Linux - General
User Name
Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.


  Search this Thread
Old 02-19-2003, 08:35 AM   #1
Registered: Mar 2001
Location: Sweden, Lund
Distribution: Slackware
Posts: 68

Rep: Reputation: 15

Hi all,

I have a small shell parsing problem:

I have two strings(or I can concatenate them if you like) which in which I only want the unique words.
I tried piping them to uniq -u(only output unique) but that didn't work since uniq sort one lines, not words.

Any idea how to solve this? Perhaps there's a way to convert the string so the words are separeted by lines instead?

Any ideas are appreciated,

Old 02-19-2003, 09:22 AM   #2
Senior Member
Registered: Feb 2001
Location: Atlanta, GA
Distribution: Slackware
Posts: 1,821

Rep: Reputation: 121Reputation: 121
If you dont care about the order you can do this:

cat $1 | tr [:blank:] '\012' | sort -u
Old 02-19-2003, 09:29 AM   #3
Registered: Mar 2001
Location: Sweden, Lund
Distribution: Slackware
Posts: 68

Original Poster
Rep: Reputation: 15
Thank You!


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 On
HTML code is Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
uniq in tcl/tk liguorir Linux - Software 1 05-20-2004 10:34 PM
Catch-22 with 'uniq' - sed, awk, another way out? slakmagik Linux - General 5 07-31-2003 09:18 AM > Forums > Linux Forums > Linux - General

All times are GMT -5. The time now is 01:31 PM.

Main Menu
Write for LQ is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration