Scripting Blog [archived]

Formerly known as the "Hey, Scripting Guy!" blog

How Can I Count the Number of Times a Word Appears in a Log File?

(image) Hey, Scripting Guy! How can I count the number of times the word Failure appears in a log file? There’s one catch, though: the log file simply writes its events one after another, creating one big, giant line of text.-- FS(image) (image) (image) Hey, FS. According to the rest of your email, your log file looks something like this...

How Can I Print Text Files to a Printer Other than the Default Printer?

(image) Hey, Scripting Guy! How can I print text files to a printer other than the default printer?-- JD(image) (image) (image) Hey, JD. Boy, talk about pride going before the fall. When we first set out to answer this question we already “knew” how to solve the problem. We were well aware that the Shell object provides a way for you ...

How Can I Use ADO to Read a Text File Where All the Data is on a Single Line?

(image) Hey, Scripting Guy! I have a fixed-width text file which includes first name (6 characters), last name (13 characters), and department (9 characters) all on a single line. How do I read that using ADO?-- DW(image) (image) (image) Hey, DW. Well, to be perfectly honest, we don’t think you can read a file like this using ADO (...

How Can I Read a Text File on a Remote Computer?

(image) Hey, Scripting Guy! How can I read a text file on a remote computer?-- BM(image) (image) (image) Hey, BM. We have a confession to make: we’re using you and your question for our own nefarious purposes. Earlier this week we answered a question about reading the last line in a group of text files; in our answer we promised we’d ...