File::Tabular

File::Tabular can search and edit flat tabular files.
Download

File::Tabular Ranking & Summary

Advertisement

  • Rating:
  • License:
  • Perl Artistic License
  • Price:
  • FREE
  • Publisher Name:
  • Laurent Dami
  • Publisher web site:
  • http://search.cpan.org/~dami/

File::Tabular Tags


File::Tabular Description

File::Tabular can search and edit flat tabular files. File::Tabular can search and edit flat tabular files.SYNOPSIS use File::Tabular; my $f = new File::Tabular($filename); my $row = $f->fetchrow; print $row->{field1}, $row->{field2}; $row = $f->fetchrow(where => 'someWord'); $row = $f->fetchrow(where => 'field1 > 4 AND field2 >= "01.01.2001"'); $row = $f->fetchrow(where => qr/somes+(complexs*)?(regex|regular expression)/i); $f->rewind; my $rows = $f->fetchall(where => 'someField =~ ^+'); print $_->{someField} foreach @$rows; $f->rewind; $rows = $f->fetchall(where => '+field1:someWord -field2:otherWord', orderBy => 'field3, field6:num, field5:-alpha'); $f->rewind; my $hashRows = $f->fetchall(where => 'foo AND NOT bar', key => 'someField'); print $hashRows->{someKey}{someOtherField}; # open for updates, and remember the updates in a journal file $f = new File::Tabular("+>$journalFile"}); # updates at specific positions (line numbers) $f->splices(4 => 2, undef, # delete 2 lines from position 4 7 => 1, {f1 => $v1, f2 => $v2, ...}, # replace line 7 9 => 0, { ...}, # insert 1 new line at position 9 22 => 0, # insert several lines at pos. 22 ... -1 => 0, # append at the end ); # shorthand to add new data at the end $f->append({f1 => $v1, f2 => $v2, ...}); # same thing, but use the "Hash::Type" associated to the file $f->append($f->ht->new($v1, $v2, ...)); $f->clear; # removes all data (but keeps the header line) # updates at specific keys, corresponding to @keyFields $f->writeKeys({key1 => {f1 => $v1, f2 => $v2, ...}, # add or update key2 => undef, # remove ... }, @keyFields); # replay the updates on a backup file my $bck = new File::Tabular("+ Requirements: · Perl


File::Tabular Related Software