06-08-2005
It's somewhat difficult to follow the thread, but.... I think I understand what you're after.
Usually you don't to store ALL the records, but rather one record per key - where the 'key' is your 'unique identifier' for the type of a record.
Awk has a notion of the 'associative arrays' - very similar to perl's hashes. You can store by a 'key', update by a 'key' and lookup by a 'key'.
You can process your CSV once, store the relative pieces of a file in the array, manipulate the array cells as you go AND post-process the content of the array in the awk's 'END' session [by iterating through the array: for( i in array)].
The associative arrays are dynamic in nature and their size is bound only by the available memory. Seems like you don't have huge files to process - you should be ok.
8 More Discussions You Might Find Interesting
1. UNIX for Dummies Questions & Answers
I was just wondering if it would be alright to dual boot a machine with both UNIX using XTERM for the interface and windows 98 or if people consider this a bad idea? if you consider it bad do tell me some possible alternatives..also would it be better to get linux over pure unix? I'd like a visual... (8 Replies)
Discussion started by: PravusMentis
8 Replies
2. UNIX for Dummies Questions & Answers
I was told that it's a Bad Idea (especially for root ) to Add To the Variable $PATH in unix the ":." (dot),
In order to execute programs in my current directory without typing ./program
For example: PATH=$PATH:$HOME/bin:.
Does someone know why is it a Bad Idea? (2 Replies)
Discussion started by: amitbern
2 Replies
3. Shell Programming and Scripting
txt file like this,
1 2 3 4456
a bb c d 3 f e
1 k 32 d m f e
123 m 2 k
every line contains 3 or more columns, all the columns are separated by space, and every column includes 1 to 3 character.
what I wanna do is deleting the first three columns, and keep the rest no matter how long... (7 Replies)
Discussion started by: fedora
7 Replies
4. Shell Programming and Scripting
Reading this file. I want to read all 4 fields.
If 2 is populated with a p, I want to set $TYPEP to "Printers",
if not should be empty.
If 3 is populated with an r, I want to set $TYPER to "REQ Printers"
if not should be empty.
If 4 is populated with letter o, I want to set $TYPEO to... (12 Replies)
Discussion started by: Skyybugg
12 Replies
5. OS X (Apple)
Well i was tidying up some files in a very important directory on our development server and somehow some plank had put a recursive sybmolic link in it. Which I the even bigger plank tried to delete from my FTP client. My FTP client then thought it would be OK to delete not only the sybmolic link... (0 Replies)
Discussion started by: timgolding
0 Replies
6. UNIX for Advanced & Expert Users
Hi folks.
I work with several production servers, and I have seen in some Kernel Cache using most of the memory.
See this pic:
http://i51.tinypic.com/301nb6c.jpg
Do you think this is a smart choice? Remember these are productions servers and it is extremely necesary this does not... (6 Replies)
Discussion started by: erick_tuk
6 Replies
7. Red Hat
is placing two RAID5 arrays on disk as shown below Is advisable? Will this create performance problems?
sda-(500GB) sdb-(1TB) sdc-(1TB) sdd-(1TB)
(250MB)----------(250MB) ---------unused------------unused------->(/dev/md0) RAID1
... (6 Replies)
Discussion started by: Saed
6 Replies
8. Shell Programming and Scripting
Hi,
I have a shell script where a lot of the code is repeated. I wanted to make the code much more compact so I spoke to a guy and he suggested using arrays, like follows:
#!/bin/bash
readonly -a nginx=('nginx' '--prefix=/opt' '-j 4'
'http://nginx.org/download/nginx-1.2.2.tar.gz'
)... (2 Replies)
Discussion started by: Spadez
2 Replies
LEARN ABOUT PHP
dbase_get_record_with_names
DBASE_GET_RECORD_WITH_NAMES(3) 1 DBASE_GET_RECORD_WITH_NAMES(3)
dbase_get_record_with_names - Gets a record from a database as an associative array
SYNOPSIS
array dbase_get_record_with_names (int $dbase_identifier, int $record_number)
DESCRIPTION
Gets a record from a dBase database as an associative array.
PARAMETERS
o $dbase_identifier
- The database link identifier, returned by dbase_open(3) or dbase_create(3).
o $record_number
- The index of the record.
RETURN VALUES
An associative array with the record. This will also include a key named deleted which is set to 1 if the record has been marked for dele-
tion (see dbase_delete_record(3)).
Each field is converted to the appropriate PHP type, except:
o Dates are left as strings.
o Integers that would have caused an overflow (> 32 bits) are returned as strings.
On error, dbase_get_record_with_names(3) will return FALSE.
EXAMPLES
Example #1
Listing all the registered members in the database
<?php
// open in read-only mode
$db = dbase_open('/tmp/test.dbf', 0);
if ($db) {
$record_numbers = dbase_numrecords($db);
for ($i = 1; $i <= $record_numbers; $i++) {
$row = dbase_get_record_with_names($db, $i);
if ($row['ismember'] == 1) {
echo "Member #$i: " . trim($row['name']) . "
";
}
}
}
?>
SEE ALSO
dbase_get_record(3).
PHP Documentation Group DBASE_GET_RECORD_WITH_NAMES(3)