Insert at begin line

General questions about using TextPad

Moderators: AmigoJack, bbadmin, helios, MudGuard

Post Reply
kpad2011
Posts: 2
Joined: Mon Nov 21, 2011 12:01 am

Insert at begin line

Post by kpad2011 »

I have:
555KQN001_A.pdf
555KQN001_B.pdf
555KQN002_A.pdf
555KQN002_B.pdf
555KQN003_B.pdf


become:
E:\ZTemp\003\555KQN001_A.pdf
E:\ZTemp\004\555KQN001_B.pdf
E:\ZTemp\003\555KQN002_A.pdf
E:\ZTemp\004\555KQN002_B.pdf
E:\ZTemp\004\555KQN003_B.pdf


Thank you
ak47wong
Posts: 703
Joined: Tue Aug 12, 2003 9:37 am
Location: Sydney, Australia

Post by ak47wong »

I'm going to assume that filenames that end in "A" go in the 003 directory and those that end in "B" go in 004. If that's not the case you'll need to state what the rule is.

Call the Replace command twice:

First Replace operation:
Find what: .*A\.pdf
Replace with: E:\\ZTemp\\003\\&
Select Regular expression
Click Replace All

Second Replace operation:
Find what: .*B\.pdf
Replace with: E:\\ZTemp\\004\\&
Select Regular expression
Click Replace All
kpad2011
Posts: 2
Joined: Mon Nov 21, 2011 12:01 am

Post by kpad2011 »

Work good

Thank You very much
09RKC
Posts: 2
Joined: Sat Nov 26, 2011 12:16 am

Simple request

Post by 09RKC »

ak47wong,

I hope you can help with a question along the same line. I have several txt files that list names, up to 4000 names in each file. I've been importing the txt files and the names diaplay nicely.

All I want to do is be able to add a letter(s) to the front or back of the line. For instance, the name "Best Breakfast" (no quotes)... I'd like the results to be "zBest Breakfast" for this line and the remaining 3999 lines.

Is there a way to do this other than one at a time? I can rename files all day long but have zero experience with txt editors, augments, strings etc.

Please list specific, step 1, step 2, step 3 directions. Assume nothing :lol: , I really don't know what I'm doing in this area!

Tkx so much!
Doug
ak47wong
Posts: 703
Joined: Tue Aug 12, 2003 9:37 am
Location: Sydney, Australia

Post by ak47wong »

If you want to add the letter z to the start of each line in a file:

1. Click Search > Replace.
2. In Find what, type ^
3. In Replace with, type z
4. Select Regular expression.
5. Click Replace All.

If you want to add the letter z to the end of each line in a file:

1. Click Search > Replace.
2. In Find what, type $
3. In Replace with, type z
4. Select Regular expression.
5. Click Replace All.
09RKC
Posts: 2
Joined: Sat Nov 26, 2011 12:16 am

Post by 09RKC »

How did you learn all this stuff?! Is this buried in Help somewhere? Makes me wonder what else I can be doing with a simple entry and a click.

I *REALLY* appreciate your help. If I don't talk to you beforehand, Merry Christmas!
Doug
ak47wong
Posts: 703
Joined: Tue Aug 12, 2003 9:37 am
Location: Sydney, Australia

Post by ak47wong »

I learned this stuff many years ago when doing development on UNIX systems, but if you're interested in learning more, refer to this post by ben_josephs (who is the expert on regular expressions in these parts).

Merry Christmas! :D
Post Reply