Scripting Blog [archived]

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

Hey, Scripting Guy! How Can I Delete Duplicate Entries in a Tab-Delimited File?

(image) Hey, Scripting Guy! How can I delete the duplicate entries in a tab-delimited file?-- ST(image) (image) (image) Hey, ST. Before we start, is anyone out there familiar with the book Not Quite What I Was Planning: Six-Word Memoirs by Writers Famous and Obscure? Not Quite What I Was Planning is an interesting little book in which the ...

Hey, Scripting Guy! How Can I Use Windows PowerShell to Sort a CSV File?

(image) Hey, Scripting Guy! have a comma-separated values file that includes several different fields. I’d like to be able to read this file from Windows PowerShell and then sort the information on one (or maybe more) of these fields. However, I can’t seem to get this to work. Any suggestions?-- DW(image) (image) (image) Hey, DW. ...

How Can I Parse a Comma-Separated Values File?

(image) Hey, Scripting Guy! I have a text file which consists of individual fields separated by commas. I need to look at the second field in each line and, if it includes the word Everyone, I then need to take the sixth field in the line and write that value to a second text file. How can I do that?-- RP(image) (image) (image) Hey, RP. ...

How Can I Copy Selected Columns From a CSV File to an Excel File?

(image) Hey, Scripting Guy! How can I copy selected columns from a CSV file to an Excel file?-- MdP (image) (image) (image) Hey, MdP. One thing that people always worry about (and rightly so) is that one of these days the Scripting Guys will do something that tears a hole in the space-time continuum. Some of you might be concerned that ...

How Can I Parse a Tab-Delimited File and Then Save That as a Comma-Separated Values File?

(image) Hey, Scripting Guy! How can I parse a tab-delimited file, and then save the resulting information as a comma-separated values file?-- DM(image) (image) (image) Hey, DM. You know, yesterday morning the Scripting Guy who writes this column had to scrape the ice off his windshield; today it’s much warmer – 44 at last report – ...