Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 51719
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 10, 20262026-05-10T16:47:40+00:00 2026-05-10T16:47:40+00:00

I already know the obvious answer to this question: just download <insert favorite windows

  • 0

I already know the obvious answer to this question: ‘just download <insert favorite windows grep or grep-like tool here>’. However, I work in an environment with strict controls by the local IT staff as to what we’re allowed to have on our computers. Suffice it to say: I have access to Perl on Windows XP. Here’s a quick Perl script I came up with that does what I want, but I haven’t figured up how to set up a batch file such that I can either pipe a command output into it, or pass a file (or list of files?) as an argument after the ‘expression to grep’:

 perl -n -e 'print $_ if (m![expression]!);' [filename] 

How do I write a batch script that I can do something like, for example:

 dir | grep.bat mypattern grep.bat mypattern myfile.txt 

EDIT: Even though I marked another ‘answer’, I wanted to give kudos to Ray Hayes answer, as it is really the ‘Windows Way’ to do it, even if another answer is technically closer to what I wanted.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. 2026-05-10T16:47:41+00:00Added an answer on May 10, 2026 at 4:47 pm

    I wrote this a while back:

    @rem = '--*-Perl-*-- @echo off perl -x -S %0 %* goto endofperl   @rem -- BEGIN PERL -- '; #!d:/Perl/bin/perl.exe -w #line 10 use strict;  #use Test::Setup; use Getopt::Long;  Getopt::Long::Configure ('bundling');  my $ignore_case    = 0; my $number_line    = 0; my $invert_results = 0; my $verbose        = 0;  my $result = GetOptions(      'i|ignore_case' => \$ignore_case,      'n|number'      => \$number_line,     'v|invert'      => \$invert_results,     'verbose'       => \$verbose, ); my $regex = shift;  if ( $ignore_case ) {      $regex = '(?i:$regex)'; } $regex = qr/$regex/; print '\$regex=$regex\n'; if ( $verbose ) {      print 'Verbose: Ignoring case.\n'                      if $ignore_case;     print 'Verbose: Printing file name and line number.\n' if $number_line;     print 'Verbose: Inverting result set.\n'               if $invert_results;     print '\n'; }  @ARGV = map { glob '$_' } @ARGV;  while ( <> ) {      my $matches = m/$regex/;     next unless $matches ^ $invert_results;     print '$ARGV\:$.:' if $number_line;     print; }  __END__ :endofperl 
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Ask A Question

Stats

  • Questions 68k
  • Answers 68k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • added an answer Here are some artifacts/information that I'm used to keep at… May 11, 2026 at 12:19 pm
  • added an answer The size of the window can be monitored with onresize.… May 11, 2026 at 12:19 pm
  • added an answer First, ensure that your Global.asax file has a code-behind <%@… May 11, 2026 at 12:19 pm

Related Questions

I believe I already know the answer, but I am not 100% sure, so
I have a feeling that I already know the answer to this one, but
Ok so the obvious answer is, because the flow of a composite control demands
I want do something like this: Button btn1 = new Button(); btn1.Click += new

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.