I am trying to remove the line numbers of a text document.

Example:
N10 G01 F720 X0Y0Z0
N20 X0Y0Z0
etc...
N9000 X0Y0Z0
M0

I can remove the line number on 1 line only but need to do this throughout the entire document.

Private Sub Command1_Click()

WordFoundFlag = 0
For i = 1 To Len(Text1)
Char = Mid(Text1, i, 1)
If Char Like "[A-Za-z-]" And WordFoundFlag = 0 Then
WordFoundFlag = 1
StartPos = i
ElseIf Char Like "[!A-Za-z-]" And WordFoundFlag = 1 Then
ElseIf Char Like "[!0-9]" And WordFoundFlag = 1 Then
GoTo BYE
End If
Next

BYE:

FindFirstWord = Mid(Text1, StartPos, i - StartPos)
Text1 = Replace(Text1, FindFirstWord, "")

End Sub

Naturally, it will remove only from the first line, because after your label BYE the program encounters the End Sub and exits.

There hast to be an outer loop that reads every line of text from your text document, and within that, your program has to find the line number.

If line numbers are in the beginning of every line and they are seperated by a space with the subsequent data you have to see only the first occurance of a blank space.

regards
AV Manoharan

ok, can you give me an idea of how to do this ?
i know what i want to do.

remove until space but everything that i have tried went really bad.

thank you
les

I will sight a very simlpe example.
If you are using ordinary files then
Open two files. one file having the searial nos in INPUT mode. and another without that in OUTPUT mode. OK

Open "Path\filename of your original text document" For Input As #1
Open "Path\filename of the text document without serial Nos" For Output As #2


Dim Str1,Str2 as String
Dim i, pos, TLength As Integer

Do While Not EOF(1)
Line Input #1, Str1
TLength=len(str1)
pos=Instr(str1," ")
Str2=mid(str1,pos+1,Tlength-pos)
Line Output #2 Str2
Loop
close #1
Close #2

Thank You

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.