Contact US

Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here





I have copy the filenames in the directory to a text file.  The format of the file is
[year month date page#]-> [0010102.lib]
so this would denote 1900, January, 1st, page 2.  

How would I get the list of files in the file that ends anything after the specific date but not the page number.  So I would be able to see the list of pages on the specific date.

So it would be:
[000101##.blah], # = any number, no characters.

Thank You

RE: Strings

  print "Page $1 in $2\n" if /^\[000101..(..)\].+\[(.+)\]/;

Above Perl fragment will print the following

Page 26 in 0010102.lib
Page 16 in 0010103.lib

if run over this file.

[0001010126]-> [0010102.lib]
[0001010116]-> [0010103.lib]
[0001020126]-> [0010104.lib]
[0001020126]-> [0010105.lib]

Is this what you meant?


RE: Strings

The list of files are stored in a array, and also the files doesn't start with "[" or end with "]".  So do I just remov e the two brackets in the if statement below?
the file name is only 8 number long,
1900, January 1st, page #8.

I'm just going to loop through the whole array and from each line in the text, I just want to do the comparison whether it has the specific date with worrying about the page number.  


RE: Strings

To match [ in a Perl regular expression you need two characters '\[' because [ means something special otherwise.

So to remove the searches for square brackets you have to remove the leading backslashes as well.

Would you post a few lines from your array exactly as they're stored please?


Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Tek-Tips Forums free from inappropriate posts.
The Tek-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members! Already a Member? Login

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close