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 gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How to check number of digits in multiple files 1

Status
Not open for further replies.

vusgtx

Technical User
Feb 23, 2009
3
US
Hello all

I have about 2000 text files have the same format as below

AAAA
BBBB
CCCC
ID 8201234
IDz 8201234


In some files, there are two extra zeroes in ID & IDz rows (i.e. 820123400)
How do I search all 2000 files and delete the extra two zeroes?

Many thanks for your help.
Helen
 



Hi,
Code:
if right(YourValue,2)="00" then YourValue = Left(YourValue, Len(YourValue)-2)


Skip,
[glasses]Don't let the Diatribe...
talk you to death![tongue]

[glasses]Just traded in my old subtlety...
for a NUANCE![tongue]
 
Hi Skip,

Thanks for your help.

I forgot to mention there is a text field after the numbers.

AAAA
BBBB
CCCC
ID 8201234 Admin
IDz 8201234 Admin

And there is other information which is not in the same columns as above (header). I tried to import into excel but it messed my file up.

Helen
 



so you parse each line and look at the second value...
Code:
    Dim a, i As Integer, LineOut

'your loop

    a = Split(LineIN, "00 ")
    For i = 0 To UBound(a)
        If i = 0 And UBound(a) > 0 Then
            LineOut = LineOut & a(i) & "   "
        Else
            LineOut = LineOut & a(i)
        End If
    Next

'next in your loop




Skip,
[glasses]Don't let the Diatribe...
talk you to death![tongue]

[glasses]Just traded in my old subtlety...
for a NUANCE![tongue]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top