You are here:  » Filtering entries of a csv file based on field value


Filtering entries of a csv file based on field value

Submitted by seaveal on Wed, 2008-12-10 17:26 in

Hello,

I use MagicParser to parse large csv file on production systems and it works perfect. Today, I need to filter the entries of a csv file based on $record[FIELD7] value.

If $record[FIELD7] match a numeric value, then the whole entry is appended to another file.

The filtered entries are copied in another file so my original csv file remains unmodified.

Has anyone already done something similar?

Best regards

Submitted by support on Wed, 2008-12-10 17:28

Hi,

You can use is_numeric()... for example:

if (is_numeric($record["FIELD7"]))
{
  // do this
}
else
{
  // do this
}

Hope this helps!
Cheers,
David.