LISTSERV at the University of Georgia
Menubar Imagemap
Home Browse Manage Request Manuals Register
Previous messageNext messagePrevious in topicNext in topicPrevious by same authorNext by same authorPrevious page (February 2008, week 5)Back to main SAS-L pageJoin or leave SAS-L (or change settings)ReplyPost a new messageSearchProportional fontNon-proportional font
Date:   Fri, 29 Feb 2008 16:39:46 -0800
Reply-To:   Don <dmorgan@ROCKETMAIL.COM>
Sender:   "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From:   Don <dmorgan@ROCKETMAIL.COM>
Organization:   http://groups.google.com
Subject:   Re: Using Regular Expressions within SAS
Comments:   To: sas-l@uga.edu
Content-Type:   text/plain; charset=ISO-8859-1

on a windows system

execute a cmd command and do

a dir /s/b c:\ > c:\mydrive.txt

This dumps a listing of the folders and files to a flat file that can be read in with SAS.

if you want hidden files at the /a:h just after the /s/b

If you want just folders do a dir /a:d/s/b > c:\myfolders.txt

This dumps a listing of the folders to a flat file that can be read in with SAS.

You can probably pipe this in as well...

If you do not want the whole say you wan stuff starting under c: \partridge specify that instead of c:\

Good luck....

On Feb 29, 4:54 pm, Charles_S_Patri...@PRODIGY.NET (Charles Patridge) wrote: > To SAS-Lers, > > I am looking for some PERL (Regular) expression that will be > able to identify the following strings as part of a > file name and/or directory name - > > ie under windows, files could be named as > > myfile01 070605.txt > myfile0120080103.tst > myfile01 2007_8_23.dif > myfile01January 3, 2008.doc > > My task is to find the root ('myfile01') of these files where > the root could be any string (numeric / character combined) > > AND > > then pull off the last portion of the file name and/or > directory name and determine if that is some form of a date > such as: > > a.Yymmdd "070605" > b.yyyymmdd "20080103" > c.2007_8_23 > d.Text dates: "January 3, 2008" > > This appears to be a good example of using PERL (regular expressions), > or maybe brute force to determine what the root is, character by > character and checking against the entire set of records > to see if the root is consistent across all entries. > > It will be assumed that the root will always be the first > part of the file name, and the date portion will be the last > part of the file name. > > I will also need to determine if the date portion is in fact > some kind of date naming convention such as listed above > and probably more variations as well. > > Any help would be appreciated - I am going to start on > this over the weekend. > > Thanks for any assistance or suggestions in advance, > > Regards, > Charles Patridge > > Email: Charles_S_Patridge {at} prodigy [dot] net


Back to: Top of message | Previous page | Main SAS-L page