LinuxQuestions.org
Help answer threads with 0 replies.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 10-17-2008, 06:00 AM   #1
rattlesnakejoe
LQ Newbie
 
Registered: Oct 2008
Posts: 14

Rep: Reputation: 0
Exclude the repeats


Hi to all..
I am new to linux
I want to remove the repeats of patterns in my file.
My file is like this

master1
master2
shisya2
shisya3
guru7
guru9

As u find we have master, shisya and guru as 3 names...I want to delete the occurances of master/shisya/guru more than one time in the order of the original file..

The O/P must be

master1
shisya2
guru7

Kindly help........
 
Old 10-17-2008, 06:05 AM   #2
burschik
Member
 
Registered: Jul 2008
Posts: 159

Rep: Reputation: 31
That wouldn't be homework, would it?
 
Old 10-17-2008, 06:48 AM   #3
rattlesnakejoe
LQ Newbie
 
Registered: Oct 2008
Posts: 14

Original Poster
Rep: Reputation: 0
Quote:
Originally Posted by burschik View Post
That wouldn't be homework, would it?
SOrry......I dint understand what burschik is asking for??
 
Old 10-17-2008, 10:13 AM   #4
vikas027
Senior Member
 
Registered: May 2007
Location: Sydney
Distribution: RHEL, CentOS, Ubuntu, Debian, OS X
Posts: 1,305

Rep: Reputation: 107Reputation: 107
Smile

Quote:
Originally Posted by rattlesnakejoe View Post
SOrry......I dint understand what burschik is asking for??
he is saying, is this your homework ??

He probably wants you to try your hands on this and then come with errors.

Regards,
VIKAS
 
Old 10-17-2008, 10:41 AM   #5
rattlesnakejoe
LQ Newbie
 
Registered: Oct 2008
Posts: 14

Original Poster
Rep: Reputation: 0
Smile

Quote:
Originally Posted by rattlesnakejoe View Post
SOrry......I dint understand what burschik is asking for??
for i in `cat mypattern`
do
sed -e '/'$i'/d' myfile > myfile1
cp myfile1 myfile
done
rm -f myfile1

Is the code...........i got it
 
  


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
streaming audio sometimes repeats in mplayer lothario Linux - Software 0 02-08-2006 09:42 PM
tar --exclude --exclude-from cefn Linux - Software 4 10-11-2005 07:31 PM
Keyboard repeats WAY too fast bobo_snyder Linux - Hardware 4 09-09-2005 01:49 PM
Mplayer Repeats Everything Twice mooreted Linux - Software 0 03-13-2004 12:21 PM
SBLive 5.1 sound repeats over and over... dracflamloc Linux - Hardware 0 02-23-2004 02:38 PM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

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