[an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive] 24x7 Script Archive


Converting comma-separated data file to tab-separated file

Dim pointer, number
Dim buffer, string
Dim found, boolean

// Read comma separated file
FileReadAll( "sometext.txt", buffer )

// Replace commas with tabs
Pos( buffer, ",", 1, pointer)
isGreater( pointer, 0, found)

LoopWhile( found, ENDLOOP )
    Replace( buffer, pointer, 1, " ", buffer )
    Pos( buffer, ",", pointer, pointer)
    isGreater( pointer, 0, found)
ENDLOOP:
// Write tab separated file
FileSave( tabtext.txt, buffer )