Let’s further suppose that (for some reason) we want to replace those pesky asterisks (*) with at signs How can we do that? Well, this script should do the trick: (Get-Content C:\Scripts\Test.txt) |Īs you can see, there really isn’t much to this script in fact, if we had slightly-wider Web pages we would have put the whole thing on a single line. For example, suppose we have the following text file (C:\Scripts\Test.txt): This is line 1.*
#Microsoft word find and replace asterisk how to
With that in mind, let’s see if we can figure out how to use Windows PowerShell to replace characters in a text file. Just think, Scripting Editor: we’ll be a team for many more decades to come! That might not sound like much fun, but just imagine how healthy that should make you.Ĭonsidering the fact that we’ve spent the morning trying to figure out how to write Perl scripts (in preparation for the upcoming 2008 Winter Scripting Games), we’re feeling especially … healthy … today. Which probably comes as a huge thrill to his old friend the Scripting Editor. At the very least, he’ll be around – and working – for a long time to come. After all, if workplace stressors make you healthy, well, he’ll probably live to be 190 years old. To be truly healthy, you need those workplace stressors.Īnd that’s good news for the Scripting Guy who writes this column. When you’re at home you relax in turn, your body lets down its guard, and – wham! – before you know it you’ve caught a cold or the flu. The researchers theorized that this is because the stressors in the workplace trigger the body’s defense mechanisms, making it easier for you to ward off sickness and infections. Researchers in Europe recently discovered that people are more likely to get sick when they are on vacation than when they go to work every day. It’s true: work-related stress is supposedly good for you. Instead, the Scripting Guy who writes this column is healthy for one reason and one reason only: he’s overworked and overstressed.
#Microsoft word find and replace asterisk tv
Is that due to a rigorous program of diet and exercise? Well, no, not really, not unless you count watching TV as exercise, and not unless doughnuts are now considered part of a healthy diet. “Don’t you ever get too sick or too tired to write Hey, Scripting Guy!?”īelieve it or not, the answer to that is no, the Scripting Guy who writes this column never gets too sick or too tired to write Hey, Scripting Guy! in fact, the Scripting Guy who writes this column is probably the healthiest person in the entire world. But that’s another story.) “Every single day,” they’ll marvel. You know, a lot of people ask the Scripting Guy who writes this column, “How do you do it? How do you manage to write a new column each and every day?” (Of course, lots of other people ask him why he writes a new column each day. Hey, Scripting Guy! Using Windows PowerShell, how can I replace all the asterisks in a text file with some other character?