![]() |
|
|||
|
In a database import of over 200,000 records, I noticed that a length of 30 chars was not long enough to hold all email addresses.
With assistance of a short awk script I could quickly determine the optimal length: Code:
$ awk -f field_length.awk import_file.csv 111628 065031051@rrrrrr.com 322626 0594500515@wwwwww.co.za [snip] 361682 huilin19 78@wrwrwrwr.c ;om xxxxxxxxx@hotmail.com 146 The awk script: Code:
BEGIN {
SIZE = 0 ;
FS = "," ;
}
# field 1 is the primary key
# field 2 is the email address
{
if (length($2) > SIZE ) {
print $1, $2 ;
SIZE = length($2) ;
}
}
END {
print $2 ;
print SIZE ;
}
Code:
$ sed -ne '/361682/p' masterlist_comma.csv 361682 huilin19 78@wrwrwrwr.c ;om Code:
$ awk -f field_length.awk import_file2.csv [snip] 58
__________________
You don't need to be a genius to debug a pf.conf firewall ruleset, you just need the guts to run tcpdump Last edited by J65nko; 12th December 2011 at 05:17 AM. |
| Thread Tools | |
| Display Modes | |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| MySQL database import not helpful | J65nko | General software and network | 2 | 10th December 2011 01:45 AM |
| When is a database not so relational? | J65nko | News | 1 | 23rd May 2011 05:38 AM |
| zfs import | terryd | FreeBSD General | 1 | 23rd November 2008 08:26 PM |
| import physical freeBSD into VMWARE (ESX) server as a vServer | ccc | FreeBSD General | 6 | 3rd October 2008 07:04 AM |
| PHP database interfaces | TerryP | Programming | 6 | 11th September 2008 01:03 PM |