Success – Operation succeeded 10/1/2006. Success – Operation succeeded 10/2/2006. Failure – Operation failed 10/3/2006. Success – Operation succeeded 10/4/2006. Failure – Operation failed 10/5/2006. Success – Operation succeeded 10/6/2006. Failure – Operation failed 10/7/2006. Failure – Operation failed 10/8/2006. You’d like to have a script read through the file, toss out all the lines …
Tag Archive: text files
Apr 01
Find and Replace Text in a Text File
Although we can’t directly search and replace text inside a text file, we can do the next best thing. We can: 1) open up a text file; 2) read the text into a variable; 3) do a search-and-replace on that variable; and 4) re-save the text file. We can even do all that from the …
Apr 01
Create a CSV File
CSV is short for comma-separated-values file, a text file in which individual elements separated by commas. For example, say you have a CSV file consisting of user first names, last names, and job titles; that file might look something like this: Ken,Myer,Accountant Pilar,Ackerman,Vice-President Carol,Philips,Research Specialist How can you create a CSV file all your own? …
Apr 01
Add two Blank Lines between each Line in a File
Suppose we have a text file – left over from a previous column – that consists of a bunch of names: Ken Myer Pilar Ackerman Jonathan Haas Syed Abbas Is there an easy way to put two blank lines between each of these names? You bet there is: Const ForReading = 1 Const ForWriting = …
Apr 01
Tally Items in a Text File
Lets say we have a text file with customer names: Customer, City Michael Doe, Seattle Lionel Adams, Seattle Wendy Russel, Los Angeles Jonathan Maine, Chicago Willy Kalkstein, Boston Jimmy Andreas, Seattle Jose Luis Alvear, Los Angeles Jim Lung, Pittsburgh What you’re looking for is a script that can read through the file and report the …
Apr 01
Open Text File as Unicode or as ASCII
When you create a new Function Library and save it to your hard disk, the files are saved in Unicode. i have found out that, when i was trying to load an entire library file dynamically. I was using the following code: Const ForReading = 1 Set fso = CreateObject( “Scripting.FileSystemObject” ) Set textFile = …
Apr 01
Count how many Times the Word “Error” Appears in a Text File
the first thought is to use the InStr function to see if the word “Error” appears anywhere in each line of the log file; you could then keep a running tally of the number of times you found the word, a technique remarkably similar to the one we demonstrated in yesterday’s column. That was a …
Apr 01
Count the Number of Lines in a Text File
The FileSystemObject is extremely useful, but it also has its limitations; one of the major limitations is the fact that it can only read a file from top to bottom. Unlike, say, the Tail utility, you can’t ask the FileSystemObject to read a file from the bottom up. But that’s OK; as always seems to …
Apr 01
Read a Text File from the Bottom Up
The FileSystemObject is extremely useful, but it also has its limitations; one of the major limitations is the fact that it can only read a file from top to bottom. Unlike, say, the Tail utility, you can’t ask the FileSystemObject to read a file from the bottom up. But that’s OK; as always seems to …
Apr 01
Print Text Files Using QTP
You don’t need Microsoft Word just to print a few text files. Instead, you can use the Shell object – which is built right into the operating system – to print text files. And what’s cool about this is the fact that you can print these files even though the Shell object doesn’t have a …



Recent Comments