in reply to Load file from offset file

Your code, initial statement and final question all seem unrelated.

Here is my interpretation of what you seem to be requesting:

perl -ne 'm/($find)/ and $x{$1}++}{print qq|FIND=$find;\n|;print qq|$ +_\t$x{$_}\n| for sort keys %x' -s -- -find=var1\|var2\|var3 YourFileN +ame.txt
You seem to be on Windows. Use Double-quotes instead of single. You may also need to escape the pipe characters differently.

The code above will count the number of times 'var1','var2' and 'var3' occurs in YourFileName.txt.

     Syntactic sugar causes cancer of the semicolon.        --Alan Perlis

Replies are listed 'Best First'.
Re^2: Load file from offset file
by gio001 (Acolyte) on Mar 29, 2011 at 12:46 UTC
    Thanks for your suggestion.

    I will try your code shortly.

    To better clarify my question: I am on unix, and the perl statemt will appear inside a ksh script that I am writing to analyze the contents of large files.

    The statememt I supplied in the question is responsible to build the file by using the index file and assembling all of the data from the incoming file into the output file, and have these pieces of info returned to me also.

    This seems to work properly.

    What I am asking was the possibility to tag on some additional code that would tally the various counters I am interested in during the building of the output file.

    I hope this makes my question a bit clearer.

    Thanks.