Scripting Blog [archived]

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

How Can I Tally Up All the Words Found in a Text File?

(image) Hey, Scripting Guy! While browsing the Internet I found a script that showed me how to get a list of all the unique words in a text file. That’s useful, but I’d like to go one step further: how can I determine the number of times each of those words occurs??-- TZ(image) (image) (image) Hey, TZ. As it turns out, that’s a lot ...

How Can I Insert Text Into a “Bookmark” in a Text File?

(image) Hey, Scripting Guy! I saw your article about inserting text into a Microsoft Word bookmark. How can I do the same sort of thing in a text file?-- LR(image) (image) (image) Hey, LR. You’ll have to forgive the Scripting Guy who writes this column if he seems a little less enthusiastic today than usual. As it turns out, he happened ...

How Can I Delete Just the IP Addresses From Each Line in a Text File?

(image) Hey, Scripting Guy! I have a file that has IP addresses and server names on each line. How can I delete the IP addresses, leaving just the server names?-- RR(image) (image) (image) Hey, RR. In case you’re wondering, as we’re writing today’s column temperatures are still right around freezing and there’s still snow and ice ...

Hey, Scripting Guy! How Can I Take Action Based on the First Line of a Text File?

(image) Hey, Scripting Guy! How can I read the first line of every file in a folder and then move each file if the line contains thisdomain.com or thatdomain.com?-- AZ (image) (image) (image) Hey, AZ. We’ll get to your question in a moment. However, before we do that we have something important to say: flight of cheeses. OK, we can go...