Solved

shell regx

Posted on 1998-12-12
5
200 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

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Email validation in proper way is  very important validation required in any web pages. This code is self explainable except that Regular Expression which I used for pattern matching. I originally published as a thread on my website : http://www…
There are many situations when we need to display the data in sorted order. For example: Student details by name or by rank or by total marks etc. If you are working on data driven based projects then you will use sorting techniques very frequently.…
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…
Six Sigma Control Plans

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