Go Back   TechArena Community > Software > Software Development
Become a Member!
Forgot your username/password?
Register Tags Active Topics RSS Search Mark Forums Read SiteMap

Tags: , , , , ,

Sponsored Links



How get full line of text from select-string

Software Development


Reply
 
Thread Tools Search this Thread
  #1  
Old 02-06-2009
Member
 
Join Date: Feb 2009
Posts: 48
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.
Reply With Quote
  #2  
Old 02-06-2009
Zecho's Avatar
Member
 
Join Date: May 2008
Posts: 2,267
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}
Reply With Quote
  #3  
Old 02-06-2009
Reegan's Avatar
Member
 
Join Date: Oct 2005
Posts: 2,299
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.
Reply With Quote
  #4  
Old 02-06-2009
opaper's Avatar
Member
 
Join Date: May 2008
Posts: 2,362
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.
Reply With Quote
Reply

  TechArena Community > Software > Software Development


Thread Tools Search this Thread
Search this Thread:

Advanced Search


Similar Threads for: "How get full line of text from select-string"
Thread Thread Starter Forum Replies Last Post
How to disable full row select in Explorer roumieh2000 Operating Systems 3 05-12-2009 08:52 AM
How to let Java read text file line by line. Visala28 Software Development 3 05-08-2009 12:30 AM
Windows PowerShell Select-String HP_Crook Software Development 3 02-06-2009 11:51 AM
How to Delete last Characters from Text String Harshini Software Development 2 06-05-2009 04:24 PM
Reading text string from text file (PHP) Moderate Software Development 3 16-01-2009 03:27 PM


All times are GMT +5.5. The time now is 03:54 AM.