Welcome to TechNet Blogs Sign in | Join | Help

Browse by Tags

All Tags » string manipulation   (RSS)

Hey, Scripting Guy! Quick-Hits Friday: The Scripting Guys Respond to a Bunch of Questions (10/16/09)

In this post : Has the WMI Problem with Dates and Daylight Saving Time Been Resolved? How Can I Change the Color of Error Messages in the Windows PowerShell Console? How Can I Read a Text File and Update 2,000 User Accounts? Can I Use a WildCard Character

Hey, Scripting Guy! How Can I Clean Up File Names?

Share this post: Hey, Scripting Guy! We have a number of files that were manually created by various people in a common folder. Unfortunately, they did not follow a specific naming convention as well as they should, and as a result they do not sort very

Hey, Scripting Guy! Australian Dispatch #1: How Does a Scripting Guy Pack for a Trip?

Three o'clock in the morning is early for anyone, even a scripting guy. Yet there was this persistent annoying ringing sound that kept trying to interrupt my short-lived sleep. At last I was able to put a name to the intrusion. Alarm clock. It is time

Hey, Scripting Guy! How Can I Extract Three-Digit Numbers From a String?

Hey, Scripting Guy! I’m trying to use regular expressions to extract three-digit numbers that are enclosed by pipe characters; they embedded in string values like this: |159|468|572|843|. However, I can’t figure out the syntax that will get this to work.

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

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?

How Can I Remove All the Non-Alphabetic Characters in a String?

Hey, Scripting Guy! How can I remove all the non-alphabetic characters in a string? -- CD Hey, CD. You know, typically the Scripting Guys don’t play favorites; we treat all our readers and all the questions we receive exactly the same. (OK, so, technically

How Can I Locate a Value in a Text File and Then Parse the Line of Text Where the Value Was Found?

Hey, Scripting Guy! How can I open a CSV file, locate a value in column 1, then store the value in column 2 in a variable? -- THvdH Hey, HvdH. We have to be honest with you, it’s a little difficult for the Scripting Guy who writes this column to stay

How Can I Extract the Text Between the Header and Footer in a Text File?

Hey, Scripting Guy! How can I extract the text between the header and footer in a text file? -- LL Hey, LL. Before we answer your question we should point out that, depending on when you’re reading this, you might be missing Day 1 of Windows PowerShell

How Can I Split a String Only on Specific Instances of a Character?

Hey, Scripting Guy! I have a series of string values that I need to convert to an array, splitting the value on the ampersand (&). However, if the ampersand is followed by amp (in other words, if the string is &amp ) I don’t want to split the

How Can I Truncate Names to a Maximum of 16 Characters?

Hey, Scripting Guy! How can I truncate names to a maximum of 16 characters? -- BN Hey, BN. Brace yourself: it’s time for another trip down memory lane. When one of the Scripting Guys was going to college, he took a temporary summer job with the Green

How Can I Convert a DN to this Format: finance.fabrikam.com/Users?

Hey, Scripting Guy! How can I convert a DN to this format: finance.fabrikam.com/Users? -- CW Hey, CW. You know, this is a pretty good question; in fact, we should have used it for the Winter Scripting Games . Ah, but, on second thought, maybe it’s a good

How Can I Extract a Series of Characters Found in the Middle of a String?

Hey, Scripting Guy! I have a series of strings that look something like this: xxxxyyyyyyxx . How can I extract just the y’s? -- JB Hey, JB. And, yes, it is a Friday. But, hey, it’s just a coincidence that we happened to pick an easy question on a Friday,

How Can I Compare Two String Values Regardless of Letter Case?

Hey, Scripting Guy! I have a script that compares two email addresses and tells me whether or not they are the same. Sometimes the email addresses are the same, but the case is different: for example, one address might be example@abc.com and the other

How Can I Pick Out and Save Specific Lines in a Text File?

Hey, Scripting Guy! I’d like to be able to read through a text file, select the lines that begin with a particular word (like Failure ), and then save only those lines back to the same text file. Is there any way to do that? -- AC Hey, AC. Hey, AC. For

How Do I Get Rid of Extraneous Spaces in a String?

I know that I can use the Split command to separate a sentence like this - VBScript is fun! - into an array of individual words. However, what happens if I have a sentence like this: VBScript is fun! I can’t use a blank space as the delimiter because
More Posts Next page »
 
Page view tracker