Ask a Question related to PERL Beginners, Design and Development.
-
NeoMonk #1
Format a string containing wildcard chars . and *
Hi,
I have a tcsh script that generates some dates and then is used to grep a file.
The working code line is:
setenv BSTODAY `/bin/perl -e'@months = qw(Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec); @x=localtime time; $month=@months[$x[4]]; $day=sprintf"%2d",$x[3]; $year=sprintf"%04d",$x[5]+1900; print "$month $day $year";'`
which today would produce Dec 14 2011
the file I am grep'ing through would have records looking like this:
Dec 14 14:36:32 2011
So what I want to generate the following pattern for the grep command
Dec 14.*2011
And skip any kind of timestamp between the day and year.
Using this on the command line works great. I can't get the script line to add the .* between $day and $year.
How can I do this?
Thanks
eric
Junior Member
- Join Date
- Dec 2011
- Location
- United States
- Posts
- 1
-
#40664 [NEW]: String conversion functions wrong for multibyte chars
From: fjortiz at comunet dot es Operating system: Win32 PHP version: 5.2.1 PHP Bug Type: COM related Bug description: ... -
String Literal Too Long - (less than 4000 chars)
We have a form field where users enter in a status (free text, any characters, etc). Not in every case, but a good portion of the time, when a user... -
Getting last 5 chars of variable length string
TIA for any help on this. I have a database field that is a variable length string. I need to process some stuff IF and only if the string ends in... -
validate chars for a string
Since, everyone is so lively today, I'm going to push my luck today with this list. I need a little help here with validating a string to have only... -
Validating Chars in a String
I'm looking in my PHP book but still figure out the best way to validate that certain characters are contained in a string - for example, when a...



Reply With Quote

