Sponsored Content
Full Discussion: Duplicate removal
Top Forums UNIX for Advanced & Expert Users Duplicate removal Post 302806475 by duplicate on Monday 13th of May 2013 06:18:13 AM
Old 05-13-2013
Duplicate removal

I have an input file of 5GB which contains duplicate records and have to remove duplicate records by retaing first instance of that record .

Based on 5 fields the duplicates has to be removed .

Kindly request to help me in writing a Unix Script.




Thanks
Asim
 

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

Removal

I am using Unix as my OS on my server and would like to format my hard drive. How do I go about wiping my hard drive or is there a removal tool that I can use? (1 Reply)
Discussion started by: anaconda
1 Replies

2. UNIX for Dummies Questions & Answers

Removal of Data

Hi All, (And first up, a Happy New Year to you all! 363 days to go!) I need to make sure that our old Sun Sparcstations and Servers are clear of any Confidential data before I return them... Suggestions? I'm formatting the discs to make sure that there's nothing obvious, but would... (5 Replies)
Discussion started by: geralex
5 Replies

3. UNIX for Dummies Questions & Answers

Sort, duplicate removal - Query

Hi All, I have a problem with the sort and duplicate filter command I am using in one of my scripts. I have a '|' delimited file and want to sort and remove duplicates on the 1,2,15 fields. These fields constitute the primary key of the table I will be loading the data into. But I see that some... (4 Replies)
Discussion started by: novice1324
4 Replies

4. Shell Programming and Scripting

Removal of Duplicate Entries from the file

I have a file which consists of 1000 entries. Out of 1000 entries i have 500 Duplicate Entires. I want to remove the first Duplicate Entry (i,e entire Line) in the File. The example of the File is shown below: 8244100010143276|MARISOL CARO||MORALES|HSD768|CARR 430 KM 1.7 ... (1 Reply)
Discussion started by: ravi_rn
1 Replies

5. Homework & Coursework Questions

removal of files?

Use and complete the template provided. The entire template must be completed. If you don't, your post may be deleted! 1. The problem statement, all variables and given/known data: remove all files and only files that the first three characters start with numerals. 2. Relevant commands,... (6 Replies)
Discussion started by: linuxtraining
6 Replies

6. Shell Programming and Scripting

\n removal between two |

I have a multi-line string I'm trying to do some clean-up on. Example: 1|575|67866|"fgnhdgj"|"afhgajh agfajgf ahfjhgfk ahfkhf"|568 2|56|5435|"mayank"|"gupta gdja agdjagf"|677 3|5666|5435|"mayank"|"gupta gdja agdjagf"|677 I need a shell script that replace all \n under " ". (11 Replies)
Discussion started by: mayankgupta18
11 Replies

7. Shell Programming and Scripting

Find duplicate based on 'n' fields and mark the duplicate as 'D'

Hi, In a file, I have to mark duplicate records as 'D' and the latest record alone as 'C'. In the below file, I have to identify if duplicate records are there or not based on Man_ID, Man_DT, Ship_ID and I have to mark the record with latest Ship_DT as "C" and other as "D" (I have to create... (7 Replies)
Discussion started by: machomaddy
7 Replies

8. Shell Programming and Scripting

Duplicate line removal matching some columns only

I'm looking to remove duplicate rows from a CSV file with a twist. The first row is a header. There are 31 columns. I want to remove duplicates when the first 29 rows are identical ignoring row 30 and 31 BUT the duplicate that is kept should have the shortest total character length in rows 30... (6 Replies)
Discussion started by: Michael Stora
6 Replies

9. Web Development

Vbseo removal

first off i want to thank you for such a great site, you helped me narrow down a long search on what was wrong with my forum, i have a large forum motorbicycling DOT com which i had someone remove vbseo before they went under because of all the security problems. anyway i have lots of 404 errors... (13 Replies)
Discussion started by: atcspaul
13 Replies

10. Shell Programming and Scripting

Honey, I broke awk! (duplicate line removal in 30M line 3.7GB csv file)

I have a script that builds a database ~30 million lines, ~3.7 GB .cvs file. After multiple optimzations It takes about 62 min to bring in and parse all the files and used to take 10 min to remove duplicates until I was requested to add another column. I am using the highly optimized awk code: awk... (34 Replies)
Discussion started by: Michael Stora
34 Replies
cdb(1)							      General Commands Manual							    cdb(1)

NAME
cdb - Constant DataBase manipulation tool SYNOPSYS
cdb -q [-m] [-n num] dbname key cdb -d [-m] [dbname|-] cdb -l [-m] [dbname|-] cdb -s [dbname|-] cdb -c [-m] [-t tmpname|-] [-p perms] [-weru0] dbname [infile...] DESCRIPTION
cdb used to query, dump, list, analyze or create CDB (Constant DataBase) files. Format of cdb described in cdb(5) manpage. This manual page corresponds to version 0.78 of tinycdb package. Query cdb -q finds given key in a given dbname cdb file, and writes associated value to standard output if found (and exits with zero), or exits with non-zero if not found. dbname must be seekable file, and stdin can not be used as input. By default, cdb will print all records found. Options recognized in query mode: -nnum causes cdb to find and write a record with a given number num starting with 1 -- when there are many records with a given key. -m newline will be added after every value printed. By default, multiple values will be written without any delimiter. Dump/List cdb -d dumps contents, and cdb -l lists keys of cdbfile (or standard input if not specified) to standard output, in format controlled by presence of -m option. See subsection "Formats" below. Output from cdb -d can be used as an input for cdb -c. Create Cdb database created in two stages: temporary database is created, and after it is complete, it gets atomically renamed to permanent place. This avoids requirements for locking between readers and writers (or creaters). cdb -c will attempt to create cdb in file tmpname (or dbname with ".tmp" appended if no -t option given) and then rename it to dbname. It will read supplied infiles (or standard input if none specified). Options recognized in create mode: -t tmpname use given tmpname as temporary file. Defaults to dbname.tmp (i.e. with output file with .tmp added). Note tmpname must be in the same filesystem as output file, as cdb uses rename(2) to finalize the database creation procedure. If tmpname is a single dash (-), no temp file will be created, database will be built in-place. This mode is useful when the final renaming is done by the caller. -p perms permissions for the newly created file (usually an octal number, like 0644). By default the permissions are 0666 (with current process umask applied). If this option is specified, current umask value has no effect. -w warn about duplicate keys. -e abort on duplicate keys (implies -w). -r replace existing key with new one in case of duplicate. This may require database file rewrite to remove old records, and can be slow. -0 zero-fill existing records when duplicate records are added. This is faster than -r, but leaves extra zeros in the database file in case of duplicates. -u do not add duplicate records. -m interpret input as a sequence of lines, one record per line, with value separated from a key by space or tab characters, instead of native cdb format (see "Input/Output Format" below). Note that using any option that requires duplicate checking will slow creation process significantly, especially for large databases. Statistics cdb -s will analyze dbfile and print summary to standard output. Statistics include: total number of rows in a file, minimum, average and maximum key and value lengths, hash tables (max 256) and entries used, number of hash collisions (that is, more than one key point to the same hash table entry), minimum, average and maximum hash table size (of non-empty tables), and number of keys that sits at 10 different distances from it's calculated hash table index -- keys in distance 0 requires only one hash table lookup, 1 -- two and so on; more keys at greater distance means slower database search. Input/Output Format By default, cdb expects (for create operation) or writes (for dump/list) native cdb format data. Cdb native format is a sequence of records in a form: +klen,vlen:key->val where "+", ",", ":", "-", ">" and " " (newline) are literal characters, klen and vlen are length of key and value as decimal numbers, and key and val are key and value themselves. Series of records terminated by an empty line. This is the only format where key and value may contain any character including newline, zero () and so on. When -l option requested (list keys mode), cdb will produce slightly modified output in a form: +klen:key (note vlen and val are omitted, together with surrounding delimiters). If -m option is given, cdb will expect or produce one line for every record (newline is a record delimiter), and every line should contain optional whitespace, key, whitespace and value up to end of line. Lines started with hash character (#) and empty lines are ignored. This is the same format as mkmap(1) utility expects. OPTIONS SUMMARY
Here is a short summary of all options accepted by cdb utility: -0 zero-fill duplicate records in create (-c) mode. -c create mode. -d dump mode. -e abort (error) on duplicate key in create (-c) mode. -h print short help and exit. -l list mode. -m input or output is in "map" format, not in native cdb format. In query mode, add a newline after every value written. -nnum find and print numth record in query (-q) mode. -q query mode. -r replace duplicate keys in create (-c) mode. -s statistics mode. -t tempfile specify temporary file when creating (-c) cdb file (use single dash (-) as tempfile to stop using temp file). -u do not insert duplicate keys (unique) in create (-c) mode. -w warn about duplicate keys in create (-c) mode. AUTHOR
The tinycdb package written by Michael Tokarev <mjt@corpit.ru>, based on ideas and shares file format with original cdb library by Dan Bernstein. SEE ALSO
cdb(5), cdb(3). LICENCE
Public domain. Jan 2009 cdb(1)
All times are GMT -4. The time now is 01:11 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy