Find a word and read until a character found

Hi,
I am trying to find a keyword in the string and read until a character is found. Given that the keyword is available in the string several times, so all found keywords will go into an array.
In following example: I will look for keyword "module" and will read the sentence until a space (" ") found.
Results:
module=pngBasicInventory.dll
module=pngNetComms.dll
etc..will go into an array
Any help please?
date=May 29 06:56:29 severity=2 hostName=STPACCESS source=EventTransport module=pngnsagent.exe process=pngnsagent.exe pid=1888 thread=4780 tickCount=759631date=May 29 06:56:33 severity=2 hostName=STPACCESS source=BasicInventory module=pngBasicInventory.dll
process=pngnsagent.exe pid=1888 thread=1928 tickCount=763890date=May 29 06:56:36 severity=2 hostName=STPACCESS source=pngNetworkTransport module=pngNetComms.dll process=pngnsagent.exe pid=1888 thread=1928 tickCount=766869date=May 29 06:56:36 severity=2 hostName=STPACCESS
source=CoNetworkTransport(347) module=pngNetComms.dll process=pngnsagent.exe pid=1888 thread=1928 tickCount=766869date=May 29 06:56:36 severity=1 hostName=STPACCESS source=ConfigServer module=pngnsagent.exe process=pngnsagent.exe pid=1888 thread=1928 tickCount=766869date=May
29 06:56:36 severity=4 hostName=STPACCESS source=ServerSettings module=pngnsagent.exe process=pngnsagent.exe pid=18 thread=1928 tickCount=766869date=May 29 06:56:36 severity=4 hostName=STPACCESS source=ScheduleEngine module=AgentScheduler.dll process=pngnsagent.exe
pid=1888 thread=1960 tickCount=766932

Assuming this is in a file, you can use this.
#PowerShell V3+ approach
$Keyword = "module"
$Content = Get-Content .\list.txt
[regex]::Matches($Content,"\b$Keyword\=\S+\b").value
Or if running V2
#PowerShell V2 approach
$Keyword = "module"
$Content = Get-Content .\list.txt
[regex]::Matches($Content,"\b$Keyword\=\S+\b") | ForEach {$_.value}
Boe Prox
Blog |
Twitter
PoshWSUS |
PoshPAIG | PoshChat |
PoshEventUI
PowerShell Deep Dives Book

Similar Messages

  • Action that finds specified words and highlight the whole sentence or paragraph

    Hi All,
    I know a action file from Acrobat users group (http://acrobatusers.com/content/find-highlight-words-and-phrases) which find and highlight a set of words using Acrobat action. But, is this possible to modify the javascript to select and highlight the "whole sentence" of the word selected? I have no knowledge about javascript, but hope I can learn how to search a word and grab the sentence or even the paragraph that a selected word appears in!
    Thanks a lot for all your help.
    I copied the said javascript in below:
    / Highlight Color
    var colHilite = color.yellow;
    var oDoc = event.target;
    var aAnnts = oDoc.getAnnots({sortBy:"Author"});
    for(var i=0;i<aAnnts.length;i++)
       if(aAnnts[i].type == "Redact")
          aAnnts[i].type = "Highlight";
          aAnnts[i].strokeColor = colHilite;

    Thanks for your reply! But can I just extend the selection like a number of words or entire line of sentence before and after that search word for highlight/redaction? like Acrobat advanced search did some kind of result for finding but not wide enough I think.

  • I couldn't find a word to read except those

    Hello, I just paid more than $26 to convert PDF file to Word but it does not work the way I expect. The file is in Farsi language but when it converted I couldn't find a word to read except those are in the left side and under the Headings, Notification. Is there any way you could help me with this? Thanks    1- 64774008070

    Hi ensafali hedayat,
    How well a file converts depends largely on the quality of the original file.
    Is it possible for you to share the document with us, if it is not confidential?
    I will check it from my end.Please add the link to this forum post for reference.
    I have sent you my contact details on your email id.
    Regards,
    Florence

  • How to find a word and replace with another

    hello,
    i just finished implementing a new website. I have about 20
    pages and lots of content. Last second, I am told that they need to
    change one word with another through out the website. Since there's
    so much text content, I was wondering if Dreamweaver has a feature
    like the Microsoft Word, in which I could type in that word and
    automatically replace it with another - through out the page.
    Thnx
    Ash

    Find and Replace....
    Murray --- ICQ 71997575
    Adobe Community Expert
    (If you *MUST* email me, don't LAUGH when you do so!)
    ==================
    http://www.dreamweavermx-templates.com
    - Template Triage!
    http://www.projectseven.com/go
    - DW FAQs, Tutorials & Resources
    http://www.dwfaq.com - DW FAQs,
    Tutorials & Resources
    http://www.macromedia.com/support/search/
    - Macromedia (MM) Technotes
    ==================
    "asli" <[email protected]> wrote in message
    news:ekki09$5m2$[email protected]..
    > hello,
    >
    > i just finished implementing a new website. I have about
    20 pages and lots
    > of
    > content. Last second, I am told that they need to change
    one word with
    > another
    > through out the website. Since there's so much text
    content, I was
    > wondering if
    > Dreamweaver has a feature like the Microsoft Word, in
    which I could type
    > in
    > that word and automatically replace it with another -
    through out the
    > page.
    >
    > Thnx
    >
    > Ash
    >

  • How to find a word and copy the phrase containing the word without using the mouse

    I am using a macro to fill in a form and select fields in the form. The fields are titled and i want to use the field title to select the field and thus need to copy the name to compare with the search text and tab to the next requested field.

    Ctrl+f opens the search in page feature. However, the result is not automatically selected and ready for copying. And since you already typed the query, you wouldn't really save any time that way...
    Firefox has some accessibility features you could explore: [[Accessibility features in Firefox - Make Firefox and web content work for all users]]. These include placing a movable cursor into the page, or searching/selecting using / and other possibly useful items. Maybe between them you can find a good workflow. If not, maybe an add-on?
    ''Edit: Here's an example of how to select the word accessibility in this post:''
    Type:
    /acce
    Press:
    Esc, Ctrl+Shift+right
    ''Edit: Actually it works with Ctrl+f as well, and that might be better if the word is common so you can use Next/Previous.''
    Press:
    Ctrl+f
    Type:
    acce
    Press:
    Esc, Ctrl+Shift+right

  • Why does it seem like Apple uses support communities to find work-arounds, and not fix the issues found here?

    The problem with iTunes clipping last 15-20 seconds of song playback to jump to next song has been a problem listed since 2009, and the only solutions are from community users. No official replies at all from Apple. Why is that? I'm currently having this problem with my iPad2 and latest IOS, with no idea what is causing the problem. They haven't even looked to a fix it seems

    Due to phenomenal development in Windows, Microsoft released 4 generations of operating systems, succeeding Windows XP. Hence, on various aspects, Windows XP becomes too old to be used practically these days. So the support was pulled out.
    I do agree that Windows XP is the most successful operating system ever, so far. But, later versions added more features, enhanced security and compatibility. Moreover, at this point, Windows XP becomes more vulnerable, although security patches are made.
    Ultimately, we need to move to a more secure, feature-rich and highly compatible operating system.
    With improved features in newer versions of Windows, the NTFS filesystem has also been improved, adding new features. Hence, certain feaures that are not availble in Windows XP are available in Windows 7, again, in Windows 8.1. So is the disk management
    features.
    As for Acronis Disk Director, it's a third party software and hence we can't comment on the features/its working.
    Balaji Kundalam

  • Finding a word within a string

    Hey everyone,
    Just having a little trouble with something.
    I'm trying to find a word -- that is, not a substring, an actual word as defined by the english language -- within a string.
    For example I don't want "hell" to be found in "hello".. only "hello" to be found.
    Currently i've got two strings, one is the sentance (String input), and one is the word to be found in the sentance (String word). I need the program to find the WORD, and then go back and search for the word again and again and again until it reaches the end of the string.
    This is what I've got thus far:
              for(i = 0; i < input.length(); i++)
                   // This statement checks the string "input" for the string "word" starting at offset 0 (as this is what the variable was first defined as)
                   if(input.indexOf(word, offset) >= 0)
                        // If it finds the word at all, this line increases the offset ahead of this word so it doesn't simply find the same word again
                        offset = offset + (input.indexOf(word)) + (word.length());
                        times++;
              }At the moment this searches for the sub-string, not the WORD which is what I would like it to do.
    What's the easiest way of going about this? I've been fiddling around trying to add extra sections to the if statement, for example
    if((input.indexOf(word, offset) >= 0) && (input.charAt(offset +1) == 32))(32 as in the ASCII character for a space, which would do what I wanted it to do)
    But I eventually get errors because at some stage or another the charAt is going to be higher than the actual length of the String. Plus, this only looks if there's a space next to the word - a word can be valid if it has a ! next to it for example, or a comma...
    Thanks for any help :)
    viddy

    I think there's a word boundary marker in regex. So it'd be "\\w+hello\\w+" or whatever the marker is, to be used with a Pattern instance.

  • Find a word.. Help pleaseeeee

    I want to find a word and located sentences in the file;
    For example:
    I love java. It is a programming language. Everybody loves Java.
    Search:
    Display:
    I love java.
    Everybody loves Java.

    Mr.Ahliman wrote:
    I want to find a word and located sentences in the file;Ok, good luck with that.
    For example:
    I love java. It is a programming language. Everybody loves Java.Not sure that is a good example.
    Do you have a question?
    BTW: Perhaps this should be in the New to Java forum?

  • My Macbook all of a sudden can't open Skype, Word, Excel, Powerpoint and Entourage. I have done research and read that it has something to do with malware and viruses. Please help I feel like I have tried everything!

    This started a few days ago, when I noticed skype would not open and keeps quitting unexpectingly. Now it's all of my microsoft office programs. I have read horrible things on the internet about creeps building some sort of 'backdoor' through Mircosoft Word and are now able to access my macbook. I want to feel safe again and I want to be able to use skype again. I think I will delete Microsoft office until I find/can afford a better version.
    I have tried deleting and re-installing the programs, PRAM-ing my mac, doing the utilities organizing thing, and I downloaded 4 different scanners (Cleanmymac, VirusBarrier Express, Bitdefender Virus Scanner, and ClamXav) to help get rid of this and only one scanner found a small file that was harmful. I need some advice PLEASE!
    Thank you for your time!

    Elliottarian wrote:
    Thanks MadMac0 I followed the instructions in Terminal for the link you sent and all my programs open again!
    Sorry I'm just getting to this now, but a lot going on today in this front. There is now a "K" version of Flashback and perhaps more going on.
    A couple of considerations you need to be aware of.
    It's clear from the results of your testing that the reason you were infected is because your Java is out of date, so it's important that you keep all your software up-to-date going forward.
    But even that won't protect you from this new "K" version as Apple has not released the patch to it yet, so I encourage you to disable Java in all your browsers and consider doing so for everything by opening Java Preferences (located in /Applications/Utilities/) and unchecking the box next to "J2SE 6.0" and any other box that might be checked. If you find that some application(s) you need must use Java, then you should enable it only to run that application(s).
    We cannot be certain that what you did totally killed the Trojan, so your best bet would be to restore your Mac back to where it was before you were infected using TimeMachine. If you don't have a TimeMachine backup or cannot determine the date of infection, then your safest solution is this one:
    Courtesy of Linc Davis:
    I suggest you take the following steps immediately:
    1. Back up all data to at least two different devices, if you haven't already done so.
    2. Boot from your recovery partition (if running Mac OS X 10.7 or later) or your installation disc (if running an earlier version of the Mac OS), launch Disk Utility, and erase the startup drive. This action will destroy all data on the drive, so you must be sure of your backups.
    3. Install the Mac OS.
    4. Reboot and go through the initial setup process to create an account. Don’t import anything from your backups at this stage.
    5. If running Mac OS X 10.6.x or earlier, run Software Update.
    6. Restore the contents of all the top-level subfolders of your home folder except “Library” from the most recent backup. You can also restore the files in the Library folder, but don’t restore any of its subfolders; only the files contained in those folders, and only if they’re visible in the Finder. Don’t restore any hidden files or folders, no matter where they are.
    7. If you’re running Mac OS X 10.5.x or earlier, disable Java in Safari’s preferences, and leave it disabled until you upgrade to Mac OS X 10.6.8 or later, including all available updates. The Java web plugin is unsafe to use under older versions of the Mac OS. Note: I’m not referring to JavaScript, which is unrelated to Java, despite the similarity in the names.
    8. Change every Internet password you have, starting with banking passwords. Check all financial accounts for unauthorized transactions. Take this step only after you’ve secured your system in the preceding steps, not before.
    9. Reinstall your third-party software from fresh downloads or original media, not from backups which may be contaminated. If you use any third-party web browsers under Mac OS X 10.5.x or earlier, disable Java in their preferences, as you did with Safari in step 7.
    Of course, as of this morning you should follow my instructions for disabling Java and ignore his, at least until Apple gets that Java patch out.
    Pay particular attention to Step 8 no matter what you decide to do.

  • I accidentally dragged my toolbar out of the window on Word, and now I can't find it!

    As I was working on Microsoft Word today, I clicked on my Formatting toolbar to move it and I accidentally dragged it out of my screen. The box is still checked on the Formatting toolbar, but the toolbar itself has disappeared. I have tried resetting the Formatting toolbar and that doesn't work. I also know that re-installing Word won't work. From looking at many forums I found a temporary solution of clicking control + shift while opening word, but each time I re-open word I have to do that in order for the toolbar to show up. Also, my Word doesn't have that oval button in the top right corner that is supposed to control the toolbars.
    Any ideas how to get it back?
    Thanks

    Hey Claudia, look around on the home page(s). May be on any one of them. If you don't see it, look inside each app button, it could be buried in anyone of them. Your looking for an app button with little app buttons inside it. When you find it, press and hold on any app button until they all start to wiggle, then drag the music app button back to your bar or where ever makes you happy. Then tap the home button to lock / return the app buttons to normal use mode. Hope this helps. Cheers.

  • Issue regarding open word file and read only mode using c# & MS-word interop

    i am programmatically open a word file for search and highlight keyword. my routine is working fine. the problem is when i am opening the file programmatically then a dialog come and ask me to open file in read only mode. the dialog look like below one
    actually i do not want to open the file in read only mode because people can open and like to change and save. so guide me what i can do to not to open the file in read only mode.
    here is my full code. just have a look and tell me what is wrong in my code or tell me any trick as a result i can open the file not in read only mode. here is my code.
    private void button1_Click(object sender, EventArgs e)
                object fileName = "";
                string filePath = "";
                string strSaveasPath = "";
                DialogResult result = openFileDialog1.ShowDialog();
                if (result == DialogResult.OK)
                    fileName = openFileDialog1.FileName;
                    //strSaveasPath = Path.GetDirectoryName(path.ToString());
                //fileName = "Z:\\C0000000003.doc";
                List<string> _list = new List<string>();
                _list.Add("tridip");
                _list.Add("arijit");
                //object fileName = "D:\\CVArchievePath\\C0000000001.doc";
                object textToFind = "test";
                object readOnly = false;
                Word.Application word = new Word.Application();
                Word.Document doc = new Word.Document();
                object missing = Type.Missing;
                try
                    doc = word.Documents.Open(ref fileName, ref missing, ref readOnly,
                                              ref missing,
    ref missing, ref missing,
                                              ref missing,
    ref missing, ref missing,
                                              ref missing,
    ref missing, ref missing,
                                              ref missing,
    ref missing, ref missing,
                                              ref missing);
                    doc.Activate();
                    object matchPhrase = false;
                    object matchCase = false;
                    object matchPrefix = false;
                    object matchSuffix = false;
                    object matchWholeWord = false;
                    object matchWildcards = false;
                    object matchSoundsLike = false;
                    object matchAllWordForms = false;
                    object matchByte = false;
                    object ignoreSpace = false;
                    object ignorePunct = false;
                    object highlightedColor = Word.WdColor.wdColorGreen;
                    object textColor = Word.WdColor.wdColorLightOrange;
                    object missingp = false;
                    Word.Range range = doc.Range();
                    foreach (string line in _list)
                        textToFind = line;
                        bool highlighted = range.Find.HitHighlight(ref textToFind,
    ref missing,
    ref missing,
    ref missing,
    ref missing,
    ref missing,
    ref missing,
    ref missing,
    ref missing,
    ref missing,
    ref missing,
    ref missing,
    ref missing,
    ref missing,
    ref missing,
    ref missing,
    ref missing,
    ref missing,
    ref missing,
    ref missing);
                    System.Diagnostics.Process.Start(fileName.ToString());
                catch (Exception ex)
                    Console.WriteLine("Error : " + ex.Message);
                    //Console.ReadKey(true);
                finally
                    //doc.Close(missing, missing, missing);
                    if(doc!=null)
                        System.Runtime.InteropServices.Marshal.ReleaseComObject(doc);
                    if (word != null)
                        System.Runtime.InteropServices.Marshal.ReleaseComObject(word);
                    word = null;
                    doc = null;
                    GC.Collect();
                    GC.WaitForPendingFinalizers();

    I know it's a very old issue and I reached to this page looking for a solution. Finally, I have found a fix to this problem.
    The problem is that we create an instance of Word and do not close it correctly. This makes program believe that the file is already open and hence you're getting the respective message of file being locked by you.
    Set the visibility of your application to true and then when you close it both file and instance should close and you will not get the problem again.

  • Just purchased a Mac today. Large screen but small type size on the desktop. How can I change the font size that appears on the desktop? The only place that I can find font size is in word and this is not what I need. Thanks for your help!

    JUST PURCHASED A MAC TODAY. LION OS. NEED HELP INCREASING THE SIZE OF THE FONTS ON THE DESKTOP. EVEN THOUGH I HAVE A LARGE SCREEN, THE TYPE SIZE IS VERY SMALL. GOING TO WORD AND CHANGING THAT TYPE SIZE IS ALL I HAVE FOUND IN HELP TOPIC.

    Finder > View > Show View Options
    Change the text size to whatever you want.

  • On Pages 09, my word documents I've been saving it to iCloud, to access anywhere, but I would like to keep my docs organized in files on my finder as usual, and saving to iCloud, I lose my local one.How can I fix it and not desorganize my files?

    On Pages 09, my word documents I've been saving it to iCloud, to access anywhere, but I would like to keep my docs organized in files on my finder as usual, and saving to iCloud, I lose my local one.How can I fix it and not desorganize my files?

    It's either in local folders, as it seem you had been doing, or in icloud.  If you go into the mac's Pages and view the icloud files, you can drag on onto another to create a folder.  But you can only have folder one level deep, so you can't organize your files/folders like you can on a mac, using nested folder several levels deep.

  • I would like to add to the Safari toolbar on my ipad 5 IOS 6  machine. I have searched the web and find some instructions to do this but the words and pictures do not match what I can see. I am beginning to think this is not a capabilty of the ipad 5

    I would like to add to the Safari toolbar on my ipad 5 IOS 6  machine. I have searched the web and find some instructions to do this but the words and pictures do not match what I can see. I am beginning to think this is not a capabilty of the ipad 5 but perhaps for a Mac computer running Safari. Does anyone know if it is possible to add tools to the toolbar on the latest version of iPad OS & Safari Browser? If so please tell me how. Thanks

    You cannot customize the Safari toolbar on the iPad.
    What you can do on the iPad is go to Settings>Safari>Always show Bookmarks Bar>On and that will add a bookmarks bar on to the Safari browser.

  • Find/Change words (with GREP) and apply a style...

    I need a Script for Find/Change words with GREP, and apply a paragraph style...
    Thanks...

    Hi Marcos,
    If you want the script to create character styles: Bold , Italic, Bold Italic, etc, and replace local formatting with these styles, use scripts in post #3.
    But if you want find and change words, or/and replace local formatting with styles defined by you, use FindChangeByList script.
    If the latter, I recommend you to download and install Record Find Change script (written by Martin Fisher).
    Then choose settings you need in Find-Change dialog – make sure they work as expected – and run Record Find Change script. A Notepad/TextEdit file will pop up with a line containing the recorded setting. Copy it, open FindChangeList.txt, delete the contents of this file and paste the line you just copied (or add it to the bottom of the file).
    Repeat the process for all find-change operations you need.
    Finally run FindChangeByList.jsx to make all changes in one go.
    However, while using Record Find Change script, you may encounter a problem: it doesn’t record paragraph and character styles placed inside a group. But you can write references to such styles like so:
    appliedParagraphStyle:app.activeDocument.paragraphStyleGroups.item("Style Group 1"). paragraphStyles.item("Paragraph Style 1")
    Kasyan

Maybe you are looking for

  • Page will load on Imac but not on Macbook-both use Safari ?

    There is a web page for a football comment that I can load using the iMac but when I try on the MacBook it flashes up-eventualyl-the address not found page. Both use Safari and both have exactly the same preferences set, so what do I look at now ? Th

  • Find My iPhone Suggestion After Beeing Burgled

    To who it may concern – I would like to make a suggestion to the “find my iPhone/iPad/laptop app” – Please Please take some time to read my email and perhaps implement. Situation Last week my girlfriend and I were broken into by forcedentry – the rob

  • Problem with creating oracle database

    I am trying to create a new database in one of customers computers, using Database Administration Assistant. The wizard goes until "Adding Oracle Text" then I get an error message without any description. Then jump out of wizard quickly with no other

  • How to turn a string into a date value

    Hi All, What is the best way to approach a date sorting issue I have? A web service that I consume returns a date column in a string format. Thus when the user clicks the column to sort a data grid by that date value it sorts incorrectly. I realize I

  • Timeouts on WCF-BasicHttp send port

    I have set the retry count 3 at the sed port for the interval of 5 minutes, but message is getting timed out at first attempt within a minuets. Can some one suggest me the possible reason.