Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Rename Characters in filename

Status
Not open for further replies.

inforeqd

Technical User
Jan 8, 2001
95
US
Just looking for some help in doing this.

I have a directory containing files with names like this

ADYYF7FD
ABYYFX5B
BAYYFZ3D

The only common element is the YYF. I need to change those specific letters to something like XXY. How would I search for that pattern and change it in perl?? Sorry for not posting any code. I have seen numerous posts on looking for ending etc. But nothing that is related to just changing 3 Characters to another.

Any help is greatly appreciated!! TIA!!
 
Hi

Code:
[b]foreach[/b] [navy]$o[/navy] [teal]([/teal][b]glob[/b][teal]([/teal][green][i]"??YYF*"[/i][/green][teal]))[/teal] [teal]{[/teal]
  [teal]([/teal][navy]$n[/navy][teal]=[/teal][navy]$o[/navy][teal])=~[/teal][b]s[/b][fuchsia]/YYF/XXY/[/fuchsia][teal];[/teal]
  [b]rename[/b] [navy]$o[/navy][teal],[/teal][navy]$n[/navy][teal];[/teal]
[teal]}[/teal]

Feherke.
 
Thanks for the reply Feherke, when I get home tonight I'm going to try it out, plus read through some books to totally understand whats happening so I don't have to ask questions like that. Thanks again!!! Its really much appreciated!!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top