Hello!
I was hoping someone could help me out here. I've spent quite a bit of time trying to figure out how to use regular expressions to fix the extension of a large group of files in my script...and I am having some problems.
The full text of a sample looks like this:
Activity 101\audio\french\101_OUTRO_S01_fr.m2V
I want to search for everything in the file that contains this:
Activity 101\audio\***.m2V
and replace it with this:
Activity 101\audio\***.ac3
The issue is that there are files in my script located in other directories with .m2v, that are good, and I do not want to change them. Basicly how do i insert a wildcard for the data between "audio\" and ".m2v"
Thank you in advance! You guys are great on here...
- Collin
Having a problem replacing file extensions
Moderators: AmigoJack, bbadmin, helios, Bob Hansen, MudGuard
- Bob Hansen
- Posts: 1516
- Joined: Sun Mar 02, 2003 8:15 pm
- Location: Salem, NH
- Contact:
I am not sure of what you are trying to replace but to find the sections after audio\ and before .m2v try this:
Searching for this:
Activity 101\\audio\\.*\.m2v
Will find these lines:
Activity 101\audio\***.m2V
Activity 101\audio\abc.m2V
Activity 101\audio\french\123.m2V
Activity 101\audio\german\abc123.m2V
---------------------------------------------------------
Searching for this:
Activity 101\\audio\\(.*\.)m2v
Will provide \1 with these values:
***.
abc.
french\123.
german\abc123.
---------------------------------------------------------
This is done using Regular Expressions with POSIX
Searching for this:
Activity 101\\audio\\.*\.m2v
Will find these lines:
Activity 101\audio\***.m2V
Activity 101\audio\abc.m2V
Activity 101\audio\french\123.m2V
Activity 101\audio\german\abc123.m2V
---------------------------------------------------------
Searching for this:
Activity 101\\audio\\(.*\.)m2v
Will provide \1 with these values:
***.
abc.
french\123.
german\abc123.
---------------------------------------------------------
This is done using Regular Expressions with POSIX
Hope this was helpful.............good luck,
Bob
Bob
Hi Bob,
I am trying to switch the extension on a large amount of files from .m2v to .ac3
The common portion of all the files i want to find, starts with:
Activity 101\audio\
and ends with:
.m2V
I need textpad to find those files, ignore the actual file name between them (similar to "101_OUTRO_S01_Q_fr"), and replace/change only the extension .m2v to .ac3
All of the file names are derivatives of this naming sceme:
"101_OUTRO_S01_Q_fr.m2v",
"101_R1_S01_INTL_fr.m2v",
"101_R1_S03_fr.m2v"
I tried using what you suggested and was unable to get any hits. I have Regular Expression checked, as well as Use POSIX checked in my preferences.
I included a segment of the script so you can see exactly what i'm talking about.
Thanks Bob!
- Collin
--------------------------------------------
Item=AC3 Audio
{
Place Holder=No
Name=101_R1_S02_Q_fr
Resolution=NTSC
Drop Type=Non-drop frame
Data Start Time=01:06:02:20
Data End Time=01:06:22:19
File=G:\Directory\Activity 101\audio\french\101_R1_S02_Q_fr.m2V
Audio Type=AC3
Bit rate=192000
Channel=2 : 0
LFE On=No
Bsmod=complete main
}
Item=AC3 Audio
{
Place Holder=No
Name=101_R1_S03_fr
Resolution=NTSC
Drop Type=Non-drop frame
Data Start Time=01:07:00:00
Data End Time=01:07:01:29
File=G:\Directory\Activity 101\audio\french\101_R1_S03_fr.m2V
Audio Type=AC3
Bit rate=192000
Channel=2 : 0
LFE On=No
Bsmod=complete main
I am trying to switch the extension on a large amount of files from .m2v to .ac3
The common portion of all the files i want to find, starts with:
Activity 101\audio\
and ends with:
.m2V
I need textpad to find those files, ignore the actual file name between them (similar to "101_OUTRO_S01_Q_fr"), and replace/change only the extension .m2v to .ac3
All of the file names are derivatives of this naming sceme:
"101_OUTRO_S01_Q_fr.m2v",
"101_R1_S01_INTL_fr.m2v",
"101_R1_S03_fr.m2v"
I tried using what you suggested and was unable to get any hits. I have Regular Expression checked, as well as Use POSIX checked in my preferences.
I included a segment of the script so you can see exactly what i'm talking about.
Thanks Bob!
- Collin
--------------------------------------------
Item=AC3 Audio
{
Place Holder=No
Name=101_R1_S02_Q_fr
Resolution=NTSC
Drop Type=Non-drop frame
Data Start Time=01:06:02:20
Data End Time=01:06:22:19
File=G:\Directory\Activity 101\audio\french\101_R1_S02_Q_fr.m2V
Audio Type=AC3
Bit rate=192000
Channel=2 : 0
LFE On=No
Bsmod=complete main
}
Item=AC3 Audio
{
Place Holder=No
Name=101_R1_S03_fr
Resolution=NTSC
Drop Type=Non-drop frame
Data Start Time=01:07:00:00
Data End Time=01:07:01:29
File=G:\Directory\Activity 101\audio\french\101_R1_S03_fr.m2V
Audio Type=AC3
Bit rate=192000
Channel=2 : 0
LFE On=No
Bsmod=complete main
- Bob Hansen
- Posts: 1516
- Joined: Sun Mar 02, 2003 8:15 pm
- Location: Salem, NH
- Contact:
Search for:
(Activity 101\\audio\\.*\.)m2v
Replace with:
\1ac3
In the script you provided, this single line:
File=G:\Directory\Activity 101\audio\french\101_R1_S02_Q_fr.m2v
is replaced with this:
File=G:\Directory\Activity 101\audio\french\101_R1_S02_Q_fr.ac3
------------------------------------------
Searching for these:
Activity 101\audio\***.m2V
Activity 101\audio\abc.m2V
Activity 101\audio\french\123.m2V
Activity 101\audio\german\abc123.m2V
Will produce these lines:
Activity 101\audio\***.ac3
Activity 101\audio\abc.ac3
Activity 101\audio\french\123.ac3
Activity 101\audio\german\abc123.ac3
---------------------------------------------
Using Regular Expressions with POSIX
(Activity 101\\audio\\.*\.)m2v
Replace with:
\1ac3
In the script you provided, this single line:
File=G:\Directory\Activity 101\audio\french\101_R1_S02_Q_fr.m2v
is replaced with this:
File=G:\Directory\Activity 101\audio\french\101_R1_S02_Q_fr.ac3
------------------------------------------
Searching for these:
Activity 101\audio\***.m2V
Activity 101\audio\abc.m2V
Activity 101\audio\french\123.m2V
Activity 101\audio\german\abc123.m2V
Will produce these lines:
Activity 101\audio\***.ac3
Activity 101\audio\abc.ac3
Activity 101\audio\french\123.ac3
Activity 101\audio\german\abc123.ac3
---------------------------------------------
Using Regular Expressions with POSIX
Hope this was helpful.............good luck,
Bob
Bob