How get full line of text from select-string
I want to ask that how can i select full line of text form select string. Here is an explanation of what I was doing. From Select String command how can i get a full line text of a MatchInfo object. I was successful to some extent but the whole line is condensed and all the text are sticked to each line. Some lines are very long. So how do I get a select object line to get an entire line of text. Other than this what are the more select strings commands available that I can use. Can anyone tell something more about powershell.
Re: How get full line of text from select-string
To some extent your are right. But there will be some changes in the string command. This will give you the exact result of what you want. Look at the suggestion below and edit your command as per it. This will surely work for you.
Code:
Instead of Select-Object pipe the MatchInfo to ForEach-Object :
select-string ... | % {$_.line}
Re: How get full line of text from select-string
The Select-string command identifies patterns in strings. To get more information on windows powerShell then give following command -
Code:
get-help about_regular_expression
It is very easy to look for sting content form files by cmdlet. It includes wildcards via path parameter. You can use the parameter to fetch the content of files. MatchInfor object is the default result of cmdlet for any process. This object includes a detailed information about the matches.
Re: How get full line of text from select-string
Through Select-Script you can perform a multiple functions. I am listing some of them below. In Windows Power shell command line you can add some of them and get an overview of select string command.
Syntax:
- This one is use to match regular expression.
Code:
Select-String [-pattern] string[]
- Match Exact text against the value of -Pattern
Code:
Select-String [-pattern] string[] [-text string]
- It helps the matches to make them case sensitive.
Code:
Select-String [-caseSensitive]
Try some them.