Results 1 to 4 of 4

Thread: How get full line of text from select-string

  1. #1
    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.

  2. #2
    Join Date
    May 2008
    Posts
    2,297

    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}

  3. #3
    Join Date
    Oct 2005
    Posts
    2,393

    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.

  4. #4
    Join Date
    May 2008
    Posts
    2,389

    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.

Similar Threads

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

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Page generated in 1,713,512,419.81167 seconds with 16 queries