Solved

shell regx

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

Courses: Start Training Online With Pros, Today

Brush up on the basics or master the advanced techniques required to earn essential industry certifications, with Courses. Enroll in a course and start learning today. Training topics range from Android App Dev to the Xen Virtualization Platform.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Extract multiple value with delimiters from a string 4 170
Perl for loop for 2000 ms 7 100
Perl string replace for refred url 9 62
add a syntax to a csv file 8 99
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…
A year or so back I was asked to have a play with MongoDB; within half an hour I had downloaded (http://www.mongodb.org/downloads),  installed and started the daemon, and had a console window open. After an hour or two of playing at the command …
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…
This Micro Tutorial demonstrates using Microsoft Excel pivot tables, how to reverse engineer competitors' marketing strategies through backlinks.

776 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