LinuxQuestions.org
Latest LQ Deal: Linux Power User Bundle
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 02-05-2013, 10:40 PM   #1
nicksu
Member
 
Registered: Dec 2012
Posts: 35

Rep: Reputation: Disabled
How to remove duplicated word in one line


Hi guys,as caption says,how to remove the duplicated words in on line ? I have tried to replace the space between words to "\n" and then sort then uniq and then replace the new line sign back to space,it do but so complicated.
Can anybody told me how to reach it more convenient ?
 
Old 02-05-2013, 10:49 PM   #2
shivaa
Senior Member
 
Registered: Jul 2012
Location: Grenoble, Fr.
Distribution: Sun Solaris, RHEL, Ubuntu, Debian 6.0
Posts: 1,800
Blog Entries: 4

Rep: Reputation: 286Reputation: 286Reputation: 286
Replacing space with a newline, find unique words and then adjusting them back in one line is not at all a good and recommended way. It may alter your original content.

While on the other hand, you can find lots of similar threads over internet like code shown in this link may help you.

Good luck!

Last edited by shivaa; 02-05-2013 at 10:51 PM.
 
Old 02-06-2013, 12:41 AM   #3
grail
LQ Guru
 
Registered: Sep 2009
Location: Perth
Distribution: Manjaro
Posts: 9,425

Rep: Reputation: 2826Reputation: 2826Reputation: 2826Reputation: 2826Reputation: 2826Reputation: 2826Reputation: 2826Reputation: 2826Reputation: 2826Reputation: 2826Reputation: 2826
Generally helps if you provide a before and after picture as well of what your data looks like / will look like.
 
Old 02-06-2013, 01:12 AM   #4
chrism01
LQ Guru
 
Registered: Aug 2004
Location: Sydney
Distribution: Centos 6.8, Centos 5.10
Posts: 17,260

Rep: Reputation: 2328Reputation: 2328Reputation: 2328Reputation: 2328Reputation: 2328Reputation: 2328Reputation: 2328Reputation: 2328Reputation: 2328Reputation: 2328Reputation: 2328
You may find this page useful http://www.linuxquestions.org/questi...342/page2.html
 
  


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] remove duplicated stringd in a line... masavini Programming 18 05-17-2012 01:17 AM
[SOLVED] Awk to search for a string and remove the line above if it does not contain a word wolverene13 Linux - Newbie 3 10-01-2011 07:13 PM
Remove line in Microsoft Word TigerLinux General 22 04-26-2011 01:29 AM
How to remove duplicated launcher on gnome panel menu? openfun Debian 8 10-06-2005 07:49 PM


All times are GMT -5. The time now is 04:43 PM.

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