Solved

shell regx

Posted on 1998-12-12
5
199 Views
Last Modified: 2010-05-18
WinNT - DOS

User passes dos/win wild cards.
Short of using system(dir $arg) to collect file names
is there a module/switch to operate with the shell's understanding of "wild".  (Those '?' are killing
me)

Would really like to @f = grep 'shellWild' readdir(D);

0
Comment
Question by:hank1
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
  • 2
5 Comments
 
LVL 1

Accepted Solution

by:
flivauda earned 20 total points
ID: 1206923
print "Please enter files to search for: ";
$args = <STDIN>; chop ($args);
open (FILES, "dir $args |");
while ($f = <FILES>)
{
 print "$f";
}
0
 
LVL 1

Expert Comment

by:flivauda
ID: 1206924
Actually I would use a dir /b if you just want the file names:

print "Please enter files to search for: ";
$args = <STDIN>; chop ($args);
open (FILES, "dir /b $args |");
while ($f = <FILES>)
{
 print "$f";
}

then you can set the $args value through code or user input.  Then put all the files into an array or whatever you need to do
0
 
LVL 1

Author Comment

by:hank1
ID: 1206925
Command line only.  I see there is nothing else.  Would have thought there
was a shell sense mod.  I got to get out of this java mode. Thanks.
0
 
LVL 84

Expert Comment

by:ozo
ID: 1206926
Isn't the glob function implemented in your perl?
(of course it just does something similar to the above sysyem call anyway)
You might also look at sub fileglob_to_re in find2perl
0
 
LVL 1

Author Comment

by:hank1
ID: 1206927
Well lookie here... File::DosGlob.  Thanks to the omnipresent Mr OZO.
0

Featured Post

On Demand Webinar - Networking for the Cloud Era

This webinar discusses:
-Common barriers companies experience when moving to the cloud
-How SD-WAN changes the way we look at networks
-Best practices customers should employ moving forward with cloud migration
-What happens behind the scenes of SteelConnect’s one-click button

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Can Oracle Client 11.2.0.2.0 work with an Oracle 12c Database? 5 179
compress files in RAR using perl 13 93
perl to convert excel to csv 3 336
PERL - Find newest folder 12 192
I've just discovered very important differences between Windows an Unix formats in Perl,at least 5.xx.. MOST IMPORTANT: Use Unix file format while saving Your script. otherwise it will have ^M s or smth likely weird in the EOL, Then DO NOT use m…
In the distant past (last year) I hacked together a little toy that would allow a couple of Manager types to query, preview, and extract data from a number of MongoDB instances, to their tool of choice: Excel (http://dilbert.com/strips/comic/2007-08…
Explain concepts important to validation of email addresses with regular expressions. Applies to most languages/tools that uses regular expressions. Consider email address RFCs: Look at HTML5 form input element (with type=email) regex pattern: T…

734 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question