Showing results for text files - Scripting Blog [archived]

Jun 20, 2008
Post comments count0
Post likes count0

Hey, Scripting Guy! How Can I Modify a Text File Based on the Value of a Particular Column in the File?

ScriptingGuy1
ScriptingGuy1

Hey, Scripting Guy! I need some help in cleaning up a text file. I have a file that contains multiple columns of data, and I need to either delete or modify lines in the file based on the value of the 13th column. Can you help me?-- AM Hey, AM. You know, usually we start off this column with some amusing (well, OK, semi-amusing) anecdote or story...

Scripting Guy!scripting techniquesVBScript
Jun 7, 2008
Post comments count0
Post likes count0

Hey, Scripting Guy! How Can I Add a Line to the Beginning of a Text File And Simultaneously Delete the Last Line of That File?

ScriptingGuy1
ScriptingGuy1

Hey, Scripting Guy! I have a script that adds a line to a log file. Each time I add a new line to this file I would like to delete the last line in the file; that way I always have 20 lines in the file. Can you help me get this to work?-- HW Hey, HW. Well, today is Friday, June 6th, which means that the Scripting Guys have to get ready to head o...

Scripting Guy!scripting techniquesVBScript
May 24, 2008
Post comments count0
Post likes count0

Hey, Scripting Guy! How Can I Extract Miscellaneous Computer Names From a Text File?

ScriptingGuy1
ScriptingGuy1

Hey, Scripting Guy! I have a text file containing thousands of events. I need to read each line in that file and look for the name of the computer where an operation failed. The computer names can – and will – vary in length; however, the name will always begin in character position 37, and be followed by the word failed. Oh, and there’s one othe...

Scripting Guy!scripting techniquesVBScript
May 15, 2008
Post comments count0
Post likes count0

Hey, Scripting Guy! How Can I Search a Text File for Activities That Took Place on a Specified Date?

ScriptingGuy1
ScriptingGuy1

Hey, Scripting Guy! I’m trying to write a script that can go through a log file and determine the number of users who logged off on a particular day. Can you help me?-- TM Hey, TM. You know, when you work at Microsoft people think you probably come to work in your pajamas, ride a unicycle through the hallways, and do all those other weird and wa...

Scripting Guy!scripting techniquesVBScript
May 9, 2008
Post comments count0
Post likes count0

How Can I Use Windows PowerShell to Report Back the Name and Creation Date for Files Containing a Specified String Value?

ScriptingGuy1
ScriptingGuy1

Hey, Scripting Guy! Using Windows PowerShell, how can I search for a string value in all the files in a folder full of text files, then report back the file name and creation date for each file where that string value was found? Oh, and I’d like to have these files sorted by date, too.-- JS Hey, JS. You know, the Scripting Guy who writes this co...

Scripting Guy!Windows PowerShellscripting techniques