Windows Vista Forums
Vista Forums Home Join Vista Forums Windows 7 Forum Vista Tutorials Tags
Welcome to Windows Vista Forums. Our forum is dedicated to helping you find solutions with any problems, errors or issues you are experiencing with Windows Vista. The Vista forum also covers news and updates and has an extensive Windows Vista tutorial section that covers a wide range of tips and tricks.

Go Back   Vista Forums > Misc Newsgroups > PowerShell

Vista - Need full line of text from select-string

Reply
 
Old 03-17-2009   #1 (permalink)
kmrneedsnethelp


 
 

Need full line of text from select-string

Hi. I need to know how to output the entire text of a MatchInfo object
resulting from the select-string command.
When I run the following it displays the correct records in the file
inputfile.txt but the lines are truncated and an ellipsis is appended to each
line.
Command:
select-string -path inputfile.txt -pattern "Microsoft" -simplematch :
select-object Line
Result:
IAD+206:H075691:4::TKIAD:4:2+20070127:153129323'GEI+S:KK+GK:69254'MGA+S:SSSS+1+1+20040414'IAB+S:SSSSSS+5+1'IAC+S:SSS...

Some of the lines in the file are very long. How do I get "select-object
Line" to output the entire line of text?

Thanks in advance.

My System SpecsSystem Spec
Old 03-17-2009   #2 (permalink)
Kiron


 
 

Re: Need full line of text from select-string

Pipe the MatchInfo to ForEach-Object instead of Select-Object:

select-string ... | % {$_.line}

--
Kiron
My System SpecsSystem Spec
Old 03-17-2009   #3 (permalink)
kmrneedsnethelp


 
 

Re: Need full line of text from select-string

Thanks alot. I just implemented a foreach solution prior to your response.

"Kiron" wrote:
Quote:

> Pipe the MatchInfo to ForEach-Object instead of Select-Object:
>
> select-string ... | % {$_.line}
>
> --
> Kiron
>
My System SpecsSystem Spec
Old 03-17-2009   #4 (permalink)
Kiron


 
 

Re: Need full line of text from select-string

Glad to help!
Like that synchronicity too...

--
Kiron
My System SpecsSystem Spec
Reply

Thread Tools


Similar Threads
Thread Forum
wscript.echo only a new line / embed a "CR" in a text string ? VB Script
Select Files - Disable or Enable Full Row Select Tutorials
problems with $var | select-string -pattern $string -q PowerShell
Search for string in CSV and delete line if string found in line PowerShell
Select-String problem with not English ASCII text PowerShell


Vista Forums is an independent web site and has not been authorized,
sponsored, or otherwise approved by Microsoft Corporation.
"Windows Vista", the Start Orb, and related materials are trademarks of Microsoft Corp.
© Designer Media Ltd

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46