Results 1 to 2 of 2
  1. #1
    Join Date
    Dec 2009

    Unanswered: Searching a pattern in multiple files

    Hi.. I am new to perl but I know there is a simple solution of the problem I am stating below. I am searching for a text pattern in mutliple files of a folder , once I find it I need to parse it in a variable and write it as a header in an excel file. Please somebody help



  2. #2
    Join Date
    Sep 2009
    This will make a fake .xls (really a tab delimited file, but Excel will handle it just fine) based on the contents of *.files. You can specify multiple files or whatever (it's all handled by the -n option) if you want.

    It is possible to write out a proper Excel file, but you'll need to install a separate module.

    perl -n -e 'push @a, $1 if /pattern(capture stuff)/; END { print join("\t", @a)."\n"; }' *.files > foo.xls

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts