Change a txt file layout using a Visual Basic
Change a txt file layout using a Visual Basic
(OP)
Hi,
I have this text to work on it:
16:04 -----------------------------
29-11-2007 16:04 CLIENT: devti-bck
29-11-2007 16:04 POLICY: devti-db2
29-11-2007 16:04 SCHEDULE: full
29-11-2007 16:04 SCHEDULE TYPE: FULL
29-11-2007 16:04 STATUS: 0
29-11-2007 16:04 STREAM: 0
29-11-2007 16:04 -----------------------------
It's about a exit status of a backup. Every backups ends, a new data it's enter in the file. I want to send all text to another file, not copy, because I need all text only in a line, using VB. Like this:
29-11-2007 16:04 CLIENT: devti-bck 29-11-2007 16:04 POLICY: devti-db2
I have this text to work on it:
16:04 -----------------------------
29-11-2007 16:04 CLIENT: devti-bck
29-11-2007 16:04 POLICY: devti-db2
29-11-2007 16:04 SCHEDULE: full
29-11-2007 16:04 SCHEDULE TYPE: FULL
29-11-2007 16:04 STATUS: 0
29-11-2007 16:04 STREAM: 0
29-11-2007 16:04 -----------------------------
It's about a exit status of a backup. Every backups ends, a new data it's enter in the file. I want to send all text to another file, not copy, because I need all text only in a line, using VB. Like this:
29-11-2007 16:04 CLIENT: devti-bck 29-11-2007 16:04 POLICY: devti-db2





RE: Change a txt file layout using a Visual Basic
CODE
<object id="objFSO" progid="Scripting.FileSystemObject" />
<script language="vbscript">
const ForReading = 1, ForWriting = 2
dim statusfile, oneliner, buff
set statusfile = objFSO.OpenTextFile (whatever, ForReading)
buff = statusfile.ReadAll
statusfile.close
replace (buff, vbCRLF, " ")
set oneliner = objFSO.CreateFile (anotherfile, true)
oneliner.WriteLine buff
oneliner.close
</script>
</job>
RE: Change a txt file layout using a Visual Basic
RE: Change a txt file layout using a Visual Basic
CODE
Dim shortline As String, longline As String
Open "multi.txt" For Input As #MULTILINE
longline = ""
Do While Not EOF(MULTILINE)
Line Input #MULTILINE, shortline
longline = longline & " " & shortline
Loop
Close #MULTILINE
Open "single.txt" For Output As #SINGLELINE
Print #SINGLELINE, longline
Close #SINGLELINE
RE: Change a txt file layout using a Visual Basic
CODE
Dim shortline As String, longline As String
MULTILINE = FreeFile
Open "multi.txt" For Input As #MULTILINE
longline = ""
Do While Not EOF(MULTILINE)
Line Input #MULTILINE, shortline
longline = longline & " " & shortline
Loop
Close #MULTILINE
SINGLELINE = FreeFile
Open "single.txt" For Output As #SINGLELINE
Print #SINGLELINE, longline
Close #SINGLELINE
Good Luck
--------------
As a circle of light increases so does the circumference of darkness around it. - Albert Einstein
RE: Change a txt file layout using a Visual Basic