http://qs321.pair.com?node_id=11124298


in reply to Extract information from several files in directory

This won't help you at the moment, but for future reference, keep in the back of your mind the modules Text::CSV, which is pure Perl, and the closely related Text::CSV_XS, which does the same things only faster, but requires local compilation that can be problematic.

These modules do lots of stuff and can be a great help when processing | reading and writing CSV files of any kind. However, their learning curve, while quite reasonable, is steep enough that you may wish to simplify your current situation by sticking close to what you know.


Give a man a fish:  <%-{-{-{-<

Replies are listed 'Best First'.
Re^2: Extract information from several files in directory
by Tux (Canon) on Nov 28, 2020 at 09:38 UTC

    If you start simple, Text::CSV_XS' interface does not have a steep learning curve at all :)

    If all your text files have a header, and you want "column" fooble extracted from all TAB-separated .txt files

    use strict; use warnings; use Text::CSV_XS qw( csv ); my @result; foreach my $f (sort glob "*.txt") { # Use File::Find for recursive act +ions csv (in => $f, headers => "auto", sep => "\t", on_in => sub { push @result => $_{fooble}; }); } open my $fh, ">", "results.txt" or die $!; say $fh $_ for grep { length } @result; close $fh;

    Enjoy, Have FUN! H.Merijn