Solved

shell regx

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

Why You Should Analyze Threat Actor TTPs

After years of analyzing threat actor behavior, it’s become clear that at any given time there are specific tactics, techniques, and procedures (TTPs) that are particularly prevalent. By analyzing and understanding these TTPs, you can dramatically enhance your security program.

Join & Write a Comment

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…
Checking the Alert Log in AWS RDS Oracle can be a pain through their user interface.  I made a script to download the Alert Log, look for errors, and email me the trace files.  In this article I'll describe what I did and share my script.
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…
Sending a Secure fax is easy with eFax Corporate (http://www.enterprise.efax.com). First, Just open a new email message.  In the To field, type your recipient's fax number @efaxsend.com. You can even send a secure international fax — just include t…

744 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

Need Help in Real-Time?

Connect with top rated Experts

13 Experts available now in Live!

Get 1:1 Help Now