Hi all,
I love this program as it has been very helpful with my work.
Can anyone share with me on how to use AFR to do the following:
Original file:
"2002",20041206,36,1,"2","03111684254", 30,"99"," ","8010","9058"," "
"2002",20041206,37,1,"2","531780103P0", 24,"99"," ","8010","9058"," "
I need to replace the bolded regions, which is a counter with a counter that has leading zeros. This field should have 6 numbers altogether. Which means that my result file should be:
"2002",20041206,000036,1,"2","03111684254", 30,"99"," ","8010","9058"," "
"2002",20041206,000037,1,"2","531780103P0", 24,"99"," ","8010","9058"," "
Thanks and I appreciate any help here.
Inserting Leading Zeros into a CSV file using Regular Expres
Thanks. How about the following cases then?
Hi Roman,
Thanks for answering my question.
I think I may not have communicated the entire scenario clearly. I need to have leading zeros for the third place variable (i.e. the counter) and this counter runs from 000001 ~ 999999. How do I include a limiter to say that we will fill up the field with leading zeroes as long as there are less than 6 chars in the field.
i.e.
1
2
36
492
4445
52341
000001
000002
000036
000492
004445
052341
I'd appreciate if you could spare some time to think on this query.
Thanks again.
Thanks for answering my question.
I think I may not have communicated the entire scenario clearly. I need to have leading zeros for the third place variable (i.e. the counter) and this counter runs from 000001 ~ 999999. How do I include a limiter to say that we will fill up the field with leading zeroes as long as there are less than 6 chars in the field.
i.e.
1
2
36
492
4445
52341
000001
000002
000036
000492
004445
052341
I'd appreciate if you could spare some time to think on this query.
Thanks again.
I thought about your scenario.
So the quick solution is to put 5 pairs into Batch grid:
Search for:
^(.+),(.+),(\d{1}),
Replace with:
$1,$2,00000$3,
Search for:
^(.+),(.+),(\d{2}),
Replace with:
$1,$2,0000$3,
Search for:
^(.+),(.+),(\d{3}),
Replace with:
$1,$2,000$3,
Search for:
^(.+),(.+),(\d{4}),
Replace with:
$1,$2,00$3,
Search for:
^(.+),(.+),(\d{5}),
Replace with:
$1,$2,0$3,
So \d means any digit
and {} mentions number of times.
So the quick solution is to put 5 pairs into Batch grid:
Search for:
^(.+),(.+),(\d{1}),
Replace with:
$1,$2,00000$3,
Search for:
^(.+),(.+),(\d{2}),
Replace with:
$1,$2,0000$3,
Search for:
^(.+),(.+),(\d{3}),
Replace with:
$1,$2,000$3,
Search for:
^(.+),(.+),(\d{4}),
Replace with:
$1,$2,00$3,
Search for:
^(.+),(.+),(\d{5}),
Replace with:
$1,$2,0$3,
So \d means any digit
and {} mentions number of times.