Hi,

Being a slow Perl learner who hasn't make much progress, I'm wondering if some kind souls could help me achieve the following 2 text substitution tasks detailed below.

********substitution 1************
The characteristic of original string:
1, always start with "$"
2, then followed by an integer, could be more than 1 digit, such as 23
3, always end with a period "."
4, there is always a blank before & after original string
For example: $2.

The characteristic of target string: always has "ebcdic" inserted into the original string between "$" and the integer
For example: $ebcdic2.

So the substitution will look like this
$2.  ->  $ebcdic2.
$67.  ->  $ebcdic67.

Should the regular expression for original string be: \$\d+\.   ?

********substitution 2************
The characteristic of original string:
1, always start with an integer, could be more than 1 digit, such as 23
2, then end with a period "."
3, there is always a blank before & after original string
For example: 2.

The characteristic of target string:
always has "s370ff" added to the beginning of original string
For example: s370ff2.

So the substitution will look like this

2.  ->  s370ff2.
14.  ->  s370ff14.

Should the regular expression for original string be: \d+\.   ?

My real situation is that I have a bunch of files at one directory, of which for the files whose name contained "readme", I need to do 2 substitutions described above.

Any input (and your time) is greatly appreciated.

Thanks,
Zhao

_______________________________________________
gnhlug-discuss mailing list
gnhlug-discuss@mail.gnhlug.org
http://mail.gnhlug.org/mailman/listinfo/gnhlug-discuss/

Reply via email to