Deleting double entry in a file


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Deleting double entry in a file
# 1  
Old 09-17-2002
Deleting double entry in a file

Hi,

I am having almost the same problem as junior member 'oupsforum' (refer to subjuct "deleting double entry in a log file"), only that I am using Sun Sorlaris Unix which the uniq command does not has the flag -w. So I am not able to ignore certain portion of the line when the uniq doing the comparison.

Is any one here farmiliar with Sun Unix, so that he/she can a give me a little help.

Thanks a lot,
Vincent
# 2  
Old 09-17-2002
why dont you try what Pererabo said. most likely it is for ksh.

Quote:
Originally posted by Perderabo
How about:
uniq <inputfile >outputfile
# 3  
Old 09-17-2002
Data

Uniq is not working for me case because the double entry is not excact duplicate of each other, only the ending parts are duplicated.

Any other suggestion ......

Thanks
# 4  
Old 09-18-2002
Re: Deleting double entry in a file

Quote:
Originally posted by Wing m. Cheng
I am using Sun Sorlaris Unix which the uniq command does not has the flag -w. So I am not able to ignore certain portion of the line when the uniq doing the comparison.
From the SunOS uniq man page:
Quote:
-s chars
Ignore the first chars characters when doing comparisons
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

How to replace multiple "&nbsp;" entry with in <td> tag into single entry using sed?

I have the input file like this. Input file: 12.txt 1) There are one or more than one <tr> tags in same line. 2) Some tr tags may have one <td> or more tna one <td> tags within it. 3) Few <td> tags having "<td> &nbsp; </td>". Few having more than one "&nbsp;" entry in it. <tr> some td... (4 Replies)
Discussion started by: thomasraj87
4 Replies

2. How to Post in the The UNIX and Linux Forums

Help me, write a bash script to delete parent entry with all their child entry in LDAP UNIX server

Hi All, Please help me and guide me to write a bash/shell script on Linux box to delete parent entry with all their child entries. example: Parent is : ---------- dn: email=yogesh.kumar@wipro.com, o=wipro, o=in child is: ---------- dn: cn: yogesh kumar, email=yogesh.kumar@wipro.com,... (1 Reply)
Discussion started by: Chand
1 Replies

3. Shell Programming and Scripting

Deleting duplicate glosses in a dictionary entry

I am working on an Urdu to Hindi dictionary and I have created the following file structure: Headword=Gloss1,Gloss2,Gloss3 i.e. glosses delimited by a comma. It so happens that in some cases (around 6000+ in a file of over 200,000+ the glosses are duplicated. Since this may be a... (3 Replies)
Discussion started by: gimley
3 Replies

4. Shell Programming and Scripting

Deleting double quoted string from a line when line number is variable

I need to remove double quoted strings from specific lines in a file. The specific line numbers are a variable. For example, line 5 of the file contains A B C "string" I want to remove "string". The following sed command works: sed '5 s/\"*\"//' $file If there are multiple... (2 Replies)
Discussion started by: rennatsb
2 Replies

5. Shell Programming and Scripting

Searching for an entry and deleting the line

Hi Im trying to scan a file for certain entries and remove their corresponding lines completely. What I have now is this, for USER in user1 user2 user3 user4 do sed '/$USER/d' /etc/sudoers done However this doesn't remove the entries at all. Is there another way for this? Thanks... (2 Replies)
Discussion started by: bludhemn
2 Replies

6. Shell Programming and Scripting

Deleting Duplicates leaving the first entry

Hi, I need to delete duplicate records in a file that is around 30MB. Below is what I need. Below are the entries of input file and the output file that I need. Each section of input file is separated by an empty line. Some of these sections have duplicate uid values. I want to retain only one... (4 Replies)
Discussion started by: Samingla
4 Replies

7. Red Hat

Adding or deleting an entry in /etc/inittab without using vi editrors or any editor.

Hi masters Is there any way to edit or delete an entry in inittab file without using vi or any editors? We can use commands instead or any shell script .. If any one can help deeply appreciated Thanks a lot sai (3 Replies)
Discussion started by: saidiya
3 Replies

8. Shell Programming and Scripting

Deleting file entry

Hello everyone, I want to compare the first line of a file(ABC) with that of a folder,XYZ(folder contents) and want that line to be deleted from the file(ABC) if that entry doesn't exist in the folder(XYZ) I want to put this in a loop. please can anyone help thanks (6 Replies)
Discussion started by: swasid
6 Replies

9. Shell Programming and Scripting

Deleting double items in file

Hi, i need a script, which deletes doulbe items in a file. My file looks like: - - - xxx xxx G123 G234 G234 G234 o o ... First i want to sort the file an then i want to delete double items. Can anyone help me. I work under solaris10. (3 Replies)
Discussion started by: free2k
3 Replies

10. Shell Programming and Scripting

deleting double entries in a log file

Hi Folks, I have a apache log file that has double entries (however not all lines appear twice). How can I delete automatically the first line of a double entry? Your help is greatly appreciated. Thanks, Klaus Here is what the log file looks like 217.81.190.164 - - "GET... (7 Replies)
Discussion started by: opusforum
7 Replies
Login or Register to Ask a Question