Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 839367
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 15, 20262026-05-15T05:27:10+00:00 2026-05-15T05:27:10+00:00

A powershell question: I want to extract each line in a character stream produced

  • 0

A powershell question: I want to extract each line in a character stream produced by an application that matches a certain pattern which in pseudo-code would be something like this:
PS> <a_ps_command> <the_application_command_for_outputting_the_text_stream> | <my_filter > output_file.txt

In my case the application is a CM-tool that outputs the change history of a source file and the (psuedo)pattern should be something like:
<a couple of numbers><a name><a time stamp><a line of characters>

Cheers,
Christian

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-15T05:27:10+00:00Added an answer on May 15, 2026 at 5:27 am

    The filtering cmdlet in PowerShell is Where-Object (aliases Where and ?). You simply pass the output of the SCM command into it. You then use $_ to represent the current line and test against it e.g.:

    tf hist .\Settings.StyleCop /i /stopafter:20 | Where {$_ -match '^\d+.*?Hack'}
    

    The -Match operator is used to compare the current line of output against a regex. I use ^\d+ to filter out the first two lines of tf hist output (which are formatting strings) and then I search on the text Hack anywhere else on the line (looking for it in comments for instance). You would modify and enhance the regex to meet your needs.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

PowerShell noob question here. I have groups of servers that are listed in separate
This question had asked for PowerShell before. I want to do this in C#.
EDIT by OP: My question presupposed that PowerShell was the best tool for this
I'm new to powershell and this question will prove that point. I'm trying a
Starting from this Question I discovered that using the powershell.exe.config to load .net Framework
This question answers how to launch PowerShell from Windows Explorer. I want to launch
I'm trying to write a Powershell function that takes an array argument. I want
What I want to do is already described in that question . But I
Simple (probably stupid) question. I'm a Powershell novice and am mainly using it to
I have a similar, but different, question like How to redirect Powershell output from

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.