Parse Text Data

Conditionally Replace Text you own this product

This project is part of the liveProject series Parse Text Data with PowerShell
intermediate PowerShell (use variables, common PowerShell built-in cmdlets, conditional and loop statements)
skills learned
read text files • edit text using replace operations • regex patterns including lookaround • use of the switch statement to modify text • write to text files
Fernando Corrales
1 week · 4-6 hours per week · INTERMEDIATE

placing your order...

Don't refresh or navigate away from the page.
liveProject This project is part of the liveProject series Parse Text Data with PowerShell liveProjects give you the opportunity to learn new skills by completing real-world challenges in your local development environment. Solve practical problems, write working code, and analyze real data—with liveProject, you learn by doing. These self-paced projects also come with full liveBook access to select books for 90 days plus permanent access to other select Manning products. $19.99 $29.99 you save $10 (33%)
Conditionally Replace Text (liveProject) added to cart
continue shopping
adding to cart

choose your plan


only $41.67 per month
  • five seats for your team
  • access to all Manning books, MEAPs, liveVideos, liveProjects, and audiobooks!
  • choose another free eBook every time you renew
  • choose twelve free eBooks per year
  • exclusive 50% discount on all purchases
  • Conditionally Replace Text eBook for free
Look inside

As a PowerShell developer, your critical mission is to help XYZ Services company, the consulting and outsourcing firm you work for, avoid payroll delays after a massive failure in its IT infrastructure. To meet a requirement in the input process to payroll, the HR department needs an update to the state field in the source file to be changed from the employee’s state of residence to the state of the office they report to. Using PowerShell best practices, you’ll write a script that uses the switch statement, PowerShell cmdlets, and advanced regex expressions to read the input file, return a list of the unique states within the file, replace the state value according to the predefined conditions—and keep those paychecks coming.

This project is designed for learning purposes and is not a complete, production-ready application or solution.

book resources

When you start your liveProject, you get full access to the following books for 90 days.

project author

Fernando Corrales
Fernando Corrales is a cloud engineer with several years of IT experience in multinational companies. He’s worked extensively with VMware products, focusing on private cloud automation with PowerCLI and PowerShell, in addition to delivering PowerShell training for some of his recent employers. Fernando holds several technical degrees from the Tecnológico de Costa Rica and has a personal blog:


This liveProject is for technology administrators and intermediate-level PowerShell users who want to learn or expand their text and string parsing skills. To begin these liveProjects you’ll need to be familiar with the following:

  • Intermediate PowerShell 7
  • Visual Studio Code with PowerShell extension

you will learn

In this liveProject, you’ll learn how to replace strings based on predefined conditions.

  • Use the switch statement to replace existing text with new values, depending on the value of a given variable or expression
  • Extract a list of unique values using the Select-String and the Select-Object cmdlets
  • Work with advanced regex expressions, including lookbehind
  • Use loops and conditional statements to sequentially process objects from a collection
  • Use the replace operator to modify text strings
  • Use Get-Content and Set-Content cmdlets
  • Read and write text to a file using PowerShell


You choose the schedule and decide how much time to invest as you build your project.
Project roadmap
Each project is divided into several achievable steps.
Get Help
While within the liveProject platform, get help from other participants and our expert mentors.
Compare with others
For each step, compare your deliverable to the solutions by the author and other participants.
book resources
Get full access to select books for 90 days. Permanent access to excerpts from Manning products are also included, as well as references to other resources.