Scripting Blog [archived]

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

Hey, Scripting Guy! How Can I Remove Duplicate Values From a Pair of Text Files?

(image) Hey, Scripting Guy! I have two text files that contain numbers. I need to write a script that can determine whether a given number exists in both of these text files. If it does, I need to delete that line from each of the two files. How do I do that?-- KT(image) (image) (image) Hey, KT. Before we get started today, we have a ...

Hey, Scripting Guy! How Can I Replace Text That Includes Double Quote Marks and a Tab Character?

(image) Hey, Scripting Guy! I read one of your columns on replacing text in a file and I found it very useful. However, I have a somewhat more-complicated need: I want to replace text that includes both double quote marks and a tab character. How can I do that?-- FC(image) (image) (image) Hey, FC. Your know, as anyone who’s ever read Hey...

Hey, Scripting Guy! How Can I Create a Bunch of .WAV Files in a Folder?

(image) Hey, Scripting Guy! For testing purposes I need to create a bunch of empty .WAV files in a folder. How can I write a script that will create those files for me?-- ZL(image) (image) (image) Hey, ZL. You know, yesterday was a very exciting day for the Scripting Guy who writes this column: he got to work from home, just like Scripting...

Hey, Scripting Guy! How Can I Make the Name of the File the First Line of Each Text File in a Folder?

(image) Hey, Scripting Guy! How can I make the name of the file the first line of each and every text file in a folder?-- DJ(image) (image) (image) Hey, DJ. And, by the way, we hope your day is going better than ours. Are we having a bad day? You might say that. For example, this morning the Scripting Guy who writes this column zoomed ...

Hey, Scripting Guy! How Can I Extract All the Text Between Two Tags in a Text File?

(image) Hey, Scripting Guy! I have a whole bunch of text files in a folder. I need to open each of these files, extract everything between the <filecount> and </filecount> tags, and then write that information to a separate file. How can I do that?-- RP(image) (image) (image) Hey, RP. You know, the other day the Scripting Guy ...