Scripting Blog [archived]

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

How Can I Count the Number of Words in a Text File?

(image) Hey, Scripting Guy! How can I count the number of words in a text file?-- LA(image) (image) (image) Hey, LA. You know, this is one of those questions where the Scripting Guys outsmarted themselves. (Not that outsmarting the Scripting Guys is particularly hard to do, mind you.) For one thing, we’re writing this column on a Friday...

How Can I Write a Script That Will Open a Text File and Shuffle the Words Found in That File?

(image) Hey, Scripting Guy! My daughter has a flash-card style program that gets its list of words from a text file. How can I write a script that will open that file and automatically shuffle the list of words?-- SN(image) (image) (image) Hey, SN. You know, for the most part we try to keep this column focused on practical system ...

How Can I Read Just the Last Line of a Text file?

(image) Hey, Scripting Guy! How can I read just the last line of a text file?-- BM(image) (image) (image) Hey, BM. You know, if you’ve ever wondered how Hey, Scripting Guy! differs from other daily columns (like, say, Dear Abby), well, here’s one way. Suppose someone writes Dear Abby and says this: Dear Abby:My life is all messed up ...