and not `strings` from binary files.
perl -ne '@_=();@_=$_=~/(\w{3,})/g;@_&&print"$.:@_$/"' test.jpg


Replies are listed 'Best First'.
Re: strings extractor
by BrowserUk (Patriarch) on Jan 08, 2007 at 12:10 UTC

    You can simplify that a bit. Regexes operate on $_ by default, and when you assign the results to @_, it will overwrite anything that is there, so there is no need to initialise it. You can also combine the statements into 1

    Updated code with corrections by animator

    perl -ne '@_=/(\w{3,})/g and print"$.:@_$/"' test.jpg

    That said, linenumbers don't make much sense in a binary file, and if you supply multiple files or a wildcard, the linenumbers will not reset to 1 for each new file.


    Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
    "Science is about questioning the status quo. Questioning authority".
    In the absence of evidence, opinion is indistinguishable from prejudice.
Re: strings extractor
by jdporter (Paladin) on Jan 08, 2007 at 14:32 UTC

    Depending on what you're looking for, you might consider using [:isprint:] rather than \w.

Re: strings extractor
by Fletch (Bishop) on Jan 08, 2007 at 14:55 UTC

    Of course there's always the PPT implementations.

    Update: Looks like ppt.perl.org is having some sort of issues; the link itself should eventually work, but if not there's always the google cache of it.