Help with quotation mark!!!

General questions about using TextPad

Moderators: AmigoJack, bbadmin, helios, Bob Hansen, MudGuard

Post Reply
anako
Posts: 5
Joined: Mon May 21, 2007 10:00 pm

Help with quotation mark!!!

Post by anako »

Can some one help me with a script on how to add quotation marks in an existing column. This is a large file and I will like to have the marks around the city, state. That's the only way the program can read the file.

This is the file before

"Vendor Stk Nbr Item Nbr Item Desc 1 Store Nbr Store Name WM Wee
1201 245505 BLKBEAUT SHEA BTR DP 930 MONTGOMERY, AL 200712
1201 245505 BLKBEAUT SHEA BTR DP 938 MONTGOMERY, AL 200702
1201 245505 BLKBEAUT SHEA BTR DP 949 DALLAS ,TX 200702
1201 245505 BLKBEAUT SHEA BTR DP 961 LA PLACE, LA 200702


This is the file after

Vendor Stk Nbr Item Nbr Item Desc 1 Store Nbr Store Name WM Week
1201 245505 BLKBEAUT SHEA BTR DP 62 "BLYTHEVILLE, AR " 200705
1201 245505 BLKBEAUT SHEA BTR DP 83 "MAGNOLIA, AR" 200705
1201 245505 BLKBEAUT SHEA BTR DP 87 "MINDEN, AR" 200705
1201 245505 BLKBEAUT SHEA BTR DP 448 "SHREVEPORT , LA" 200705
1201 245505 BLKBEAUT SHEA BTR DP 483 "PRATTVILLE, AL" 200705
1201 245505 BLKBEAUT SHEA BTR DP 488 "QUINCY, FL" 200705
1201 245505 BLKBEAUT SHEA BTR DP 539 "ALEXANDRIA, LA" 200705
1201 245505 BLKBEAUT SHEA BTR DP 588 "ALBANY, GA" 200705
1201 245505 BLKBEAUT SHEA BTR DP 707 "CLARKSDALE, MS" 200705
1201 245505 BLKBEAUT SHEA BTR DP 763 "FAIRFIELD, AL" 200705
1201 245505 BLKBEAUT SHEA BTR DP 862 "HINESVILLE, GA" 200705

Thanks!!
bveldkamp

Post by bveldkamp »

In this particular case, assuming POSIX and replacing _ with a space:

Code: Select all

Search:  (.{37})([^0-9]+)_
Replace: \1"\2"_ 
This will break the first line, so you might select everything but that one, and check "Selected Text" in the Search/Replace dialog
nitinmukesh123
Posts: 5
Joined: Fri May 19, 2006 6:50 am

Post by nitinmukesh123 »

@bveldkamp

Wonderful... can u explain a bit
bveldkamp

Post by bveldkamp »

.{37}: Find any (.) 37 characters, followed by
[^0-9]+_: one or more (+) characters, except for (^) numbers (0-9), followed by a space
() indicates a group of characters that can be used in the replace expression, so
\1"\2"_: 1st group (\1) + quote + 2nd group (\2) + quote + space
nitinmukesh123
Posts: 5
Joined: Fri May 19, 2006 6:50 am

Post by nitinmukesh123 »

Thanks for the explanation.
anako
Posts: 5
Joined: Mon May 21, 2007 10:00 pm

Post by anako »

Wonderful, thank you soo much, it worked!!!!
Post Reply