Windows PowerShell in Action: Working With Text and Files in Windows PowerShell

Windows PowerShell in Action: Working With Text and Files in Windows PowerShell

  • Comments 2

ScriptCenter has a couple chapters of Bruce Payette's awesome book:  Windows PowerShell in Action.  You can (and should) read chapter 10 at:

http://www.microsoft.com/technet/scriptcenter/topics/msh/payette1.mspx

Here what ScriptCenter says about it:

PowerShell is Microsoft's next-generation command line and scripting solution. It combines the interactive capabilities of traditional shells such as bash or zsh with the programmability of scripting languages such as Perl or Ruby. Because PowerShell is based on .NET, it's capable of doing things in a shell environment that were previously only possible in languages such as Visual Basic, VBScript, or C#.

As with any scripting language, one of the most important domains for PowerShell is the ability to work with strings and files (both text and binary). This series of articles is based on chapter 10 of Windows PowerShell in Action from Manning Publications. Chapter 10 examines how PowerShell handles text and file processing tasks, illustrating how to process and parse text using string objects and regular expressions. It also shows how to deal with paths and how to manipulate binary files. Another significant area covered in this chapter is how to work with XML. XML has become increasingly important both in the IT field and in software development. We show how to search, manipulate, and create XML documents using PowerShell.

Part one of this series looks at how to process, search, and manipulate strings and unstructured text using the .NET string object and regular expressions.

Enjoy

Jeffrey Snover [MSFT]
Windows PowerShell/MMC Architect
Visit the Windows PowerShell Team blog at:    http://blogs.msdn.com/PowerShell
Visit the Windows PowerShell ScriptCenter at:  http://www.microsoft.com/technet/scriptcenter/hubs/msh.mspx

Leave a Comment
  • Please add 5 and 4 and type the answer here:
  • Post
  • want to see what powershell can do

  • I am using "select-string  *.txt | out-file"   to write a text file based on a large directory of text files.  I am getting matchinfo data written that I DON't want.

    I am getting file & line info I don't need.

    For example:

    C:\2001\010201.txt:12:XAGUSD,20010201,021300,4.78

    All I want was the original data. ie,

    XAGUSD,20010201,021300,4.78

    Is there an easy way to eliminate the file/line info?

Page 1 of 1 (2 items)