Grepping a file for a specific pattern

          I'm trying to use a servlet to mimic a tail/grep operation on a log file. Whilst
          I can use a FileReader
          to get the contents of a file and put them to a string and display on a browser,
          I am only interested in a certain pattern.
          E.g. on my Unix web server if I type the command
          $tail -f mylog | grep 'ERROR'
          It returns only strings that contain an error message.
          I tried looking at java.util.StringTokenizer and java.io.StreamTokenizer but they
          both
          seem quite limited.
          Obviously tailing might be a bit tricky, but it would be great to find a way to
          search througha file for
          error information.
          thanks
          Mark
          

I use something like the following to go through a log file for particular
          application errors...
          Thanks
          Rob
          RandomAccessFile fis = new
          RandomAccessFile("mylog.log","r");
          long fpointer = 0;
          long flength = fis.length();
          out.println("the log file is " + flength + "
          bytes.");
          while( fpointer < flength ) {
          String s = fis.readLine();
          if(s.indexOf("ERROR") == -1)
          continue;
          "Mark McKee" <[email protected]> wrote in message
          news:3adf14db$[email protected]..
          >
          > I'm trying to use a servlet to mimic a tail/grep operation on a log file.
          Whilst
          > I can use a FileReader
          > to get the contents of a file and put them to a string and display on a
          browser,
          >
          > I am only interested in a certain pattern.
          >
          > E.g. on my Unix web server if I type the command
          >
          > $tail -f mylog | grep 'ERROR'
          >
          > It returns only strings that contain an error message.
          >
          > I tried looking at java.util.StringTokenizer and java.io.StreamTokenizer
          but they
          > both
          > seem quite limited.
          >
          > Obviously tailing might be a bit tricky, but it would be great to find a
          way to
          > search througha file for
          > error information.
          >
          > thanks
          > Mark
          

Similar Messages

  • Capturing user state........ Retaining files for a specific time?

    Capturing user state........ Retaining files for a specific time?
    Can I retain the user files/data for a specific time as a copy after capturing user states then restoring them? If so what's the procedure and location of the files?
    tconners

    If you are using a SMP, yes, this is built-in functionality. The files are located in the location(s) specified on your SMP configuration. You'll also need the computer association that created them because it contains the encryption key.
    Jason | http://blog.configmgrftw.com

  • How to asssign output value in the CSV file for the specific header

    Hi,
    I am using OpenScript 9.10. The problem I am facing is that, to Write the Output value captured from the application, When i am trying to use the methods "Appen String to File" i am unable to write / assign the out put value below the specific header. Can any one please look into this and post the methods related to Write the output vaues in to the CSV files under specific headers.
    Thanks in Advance.
    Thanks.,
    Siva

    Hi Alex,
    Thanks for your reply.I need to write the output value under specified parameter name.
    for example after creating the sales order,the order number have to write in the CSV file under
    OrderNumber column.I tried with appendStringtofille() method,by using this able to write the value under
    first column.But i need to write output value under specified columnname(means Header name in the cSV
    file).can u please give a reply for the above problem.
    Note: In that Csv file i am taking the input vales and also need to write the output values under
    specified column(header)
    Thanks,
    Siva Thota.

  • How do I find source files for a specific sound...

    This problem has plagued me through many version of GB. Basically, my roommate creates the garageband files, selects the instruments etc. Invariably when he gives me a copy of the Garageband file GB seems to swap in the instruments for some other instrument without ever alerting me that it's doing it. Basically, nothing sounds the same. We've both done clean installs, installed the same Jampacks. it says the same instruments but sometimes it will swap an organ sound for a string or something not even close.
    In Itunes, there's a way to (command-R I believe) find the source file - is there a way to do that in GB? My roommate's computer has an instrument called Piano and Strings - we can't find any file with that name and for some reason no matter what I do I can't access that sound. We're both on MacPros. Recently I alone upgraded to Snow Leopard, but this problem has gone on for years.
    What I'd like to do is sort of block GB from swapping in instruments without notifying me, or allowing me to know what those missing sounds are and some way of finding them so a GB file will play roughly the same (obviously acoustics or speakers will differ).
    thanks so much for any refs or suggestions.
    enzosf

    Tell him which instruments you have and limit him to those. Keep everything to a subset of instruments that you both have.
    Are you adding to the tracks or just listening? If just listening he can just export to iTunes.

  • Efficient searching in a large XML file for specific elements

    Hi
    How can I search in a large XML file for a specific element efficiently (fast and memory savvy?) I have a large (approximately 32MB with about 140,000 main elements) XML file and I have to search through it for specific elements. What stable and production-ready open source tools are available for such tasks? I think PDOM is a solution but I can't find any well-known and stable implementations on the web.
    Thanks in advance,
    Behrang Saeedzadeh.

    The problem with DOM parsers is that the whole document needs to be parsed!
    So with large documents this uses up a lot of memory.
    I suggest you look at sometthing like a pull parser (Piccolo or MPX1) which is a fast parser that is program driven and not event driven like SAX. This has the advantage of not needing to remember your state between events.
    I have used Piccolo to extract events from large xml based log files.
    Carl.

  • List the files process for a specific Batch ID

    Hi,
    i found the following function
    Function farsFileListForBatchID(ByVal strBatchID As String) As ADODB._Recordset
    Description:
    Return a recordset containing all files for the specified batch ID.
    unfortunately, it doesn't return the files for a specific batch ID but the content of the 14 columns of the batch content table.
    i am looking for a function which can return all files loaded or processes for a specific batch ID.
    or do i need to write a sql statement...?
    thanks
    Ben

    I have encountered several people complaining about the tool not working.
    USe at your own risk: :)
    https://onedrive.live.com/redir?resid=5407B03614346A99%21442
    When MDT opens drivers that it *knows* are dupes due to identical CRC checksums, it will postfix a "(1)" to the directory/name. I would start looking at these first.
    Keith Garner - keithga.wordpress.com

  • Multiclip on FCP 7 with timecode: multiple files for the same camera have different Angle

    I have FCStudio 7 with OS 10.6.8
    I just filmed a concert with 6 cameras (Sony XDCAM).  They are all timecode sync'd.
    For various reasons there are multiple vid files for each camera (i.e. 172_003 thru 172_006 for camera 1).
    I imported into FCP 7 using SonyXDCAM plug in with no problems.  Each camera file group was given its camera number as the Reel Name (i.e. Camera 1) and that camera's number as its Angle Name (i.e. 1).
    Now when I try and create a multiclip using all six cameras, instead of keeping all the files for a specific camera under a single angle name it treats each file as its own camera angle.  It treats each file as an individual camera instead of having the files flow as a single clip from a single camera based on their timecode.  In viewer I have 8 different angles for a single camera (because of 8 files).  In the make media window for multiclip, the Angle Name is different for each clip but its position is still aligned to its timecode.
    I worked the same project last year and the multiple files for each camera lined up fine, based on its timecode value and camera/reel name.  I can't see what has changed.
    I need each camera's files to sync under that camera Angle Name, and for the files to play in the same angle spot in viewer.
    All advice welcomed as I'm in a major time crunch to complete the job.
    Thanks.

    Well why not just prebuild each angle in its own sequence with sequence timecode matching the source timecode?  Export with current settings and import these files back into fcp and then create your multiclip. 

  • Camera File for redlake ES 2020

    Hi there,
    I have NI PCIe-1427 framegrabber.
    I'm looking for camera file for Redlake MegaPlus ES 2020 (http://www.princetoninstruments.com/products/imcam​/megaplus/).
    In the MAX configuration tree Redlake ES 2020 is not present in the menu selection camera.
    I tried to search camera file at ni.com/camera (National Instrument Industrial Camera Advisor) but it is not avaible.
    Does anyone have this camera file?
    Thanks,
    Paolo

    Hi Paolo,
    you can find all inofrmation at this link:
    http://digital.ni.com/public.nsf/allkb/05DCE386836​2783586256FC8004F123C
    If the camera file for your specific camera is not installed with the NI-IMAQ Driver, you may be able to locate it on our website. National Instrument's Camera Network allows you to search for camera files using the manufacturer and model number of your camera.
    Regards,

  • Provider Driver file for JMS

    Friends
    We have a IBM Websphere MQ 5.3 service (fix) pack 13 system. We are trying to use XI to connect to this system via JMS. My question is, are the jar or driver files that we deploy initially inorder to get the JMS to connect to MQ, service pack specific ?
    Do we have different jar files for different service pack levels of MQ system ??
    Do let me know.
    regards
    Sameer

    Hi Sameer,
    <i>are the jar or driver files that we deploy initially inorder to get the JMS to connect to MQ, service pack specific ?</i>
    Ans : No, There is nothing to do with J2EE SP Level
    <i> Do we have different jar files for different service pack levels of MQ system ??</i>
    Ans:  Yes, Jar files are MQ version specific. You need to deploy different Jar files if MQ Version is changed.
    Following is SAP note help you to select Jar files for MQ Specific version.
    <a href="https://websmp109.sap-ag.de/~form/handler?_APP=01100107900000000342&_EVENT=REDIR&_NNUM=747601&_NLANG=E">SAP Note : 747601</a>
    Best luck
    Rakesh

  • Can we give UNIQUE ACCESS FOR THE SPECIFIC FILE IN THE LIBRARY in SP2013? How can we remove users from SHARED WITH link where files are shared with users?

    Hi,
    Any help on this?
    Thanks
    srabon

    Hi srabon,
    For giving unique access for a specific file in a library, you can go to the library, and select the file , and click FILES->Shared With->ADVANCED, under PERMISSION ribbon, click ‘Stop Inheriting Permissions’, then the file will have unique permissions.
    For removing the shared users for a file, firstly, like the above steps, select the file , and click FILES->Shared With->ADVANCED , make sure the file has unique access, then select the users that you want to remove, and click Remove User Persmissions
    under PERMISSIONS ribbon.
    I hope this helps.
    Thanks,
    Wendy
    Wendy Li
    TechNet Community Support

  • Searching for a specific file size

    Hello,
    It's been a while but it seems like XP let me search for specific file sizes - e.g. if I wanted to search for files that were greater than 10GB or if I wanted to search for files less than 20GB.
    I can't figure it out in Windows 8.1.
    If the answer is possible through standard search and not powershell, I'd prefer the GUI way.
    Thanks

    In File Explorer (was Windows Explorer), type the search criteria into the box in the top right of the screen and press Enter.
    Example searches are:
    A minimum file size, simply type size:>30,000KB into the Search box and press Enter.
    type:=.pdf or type:=.doc will display specific file types.
    filename:x will display files using a partial filename. x represents the partial filename you want to search for.
    kind:video, kind:music or kind:pictures will find all the videos, music or pictures.
    If you just click or tap in the Search box, Search Tools will appear which allows the choosing of a Kind, a Size, Date Modified, Other Properties and Advanced search. In Folder Options > Search Tab, the search options can be changed, e.g. Find partial
    matches.
    Providing the location is indexed, you can search in File Explorer for a specific word or phrase by typing content:
    followed by your phrase enclosed in double quotes. This will produce a list of files matching the criterion.
    Speed up the search by opening File Explorer (was Windows Explorer) at the folder you want to search, rather than at the root folder. Also, pressing F3 will show Search options like Date Modified and Size.
    Ninety-nine per cent of politicians give the rest a bad name.

  • How to setup a routing rule for a specific file type for the content organizer?

    Hello,
    how can I set a routing rule for a specific file type, for example for "pdf" or for "docx", for my content organizer?
    As standard I can only choose for the rules the content type, name and title of the file uploaded.
    Thank you in advance!
    JohnyG

    Hi Johny,
    Based on your description, my understanding is that you want to create a routing rule for a specific file type.
    I recommend to create rules with the conditions as the image below shows for the Document content type(for example: .docx files):
    Best regards.
    Thanks
    Victoria Xia
    TechNet Community Support

  • I deleted a specific file folder from my Seagate backup drive, via Time Machine. Instead of only deleting that file, it deleted ALL my files for that date.

    1. Why? I was quite obviously selecting one file folder ONLY.
    2. Is there any way to retrieve the lost items?
    3. How do I avoid this happening in the future?

    Never had any issues while deleting specific files/folders from a time machine backup.
    However, regarding the original post, what do you mean by "file folder"? Did you select a FILE for deletion, or a FOLDER? These two terms tend to be quite different, you know.
    If you selected a FOLDER, then ALL FILES inside the folder have been deleted. If you selected a single FILE, then only that file should have been deleted. "Delete all backups of..." is a completely different story.

  • How to send a link for a specific podcast file?

    So I'm in my Podcasts directory in iTunes 5.0 and I've got a bunch of downloaded podcasts. Just listened to a particular one that I really like and I'd like to send a link for that podcast to a friend. How to get the link? I do a Get Info on the file and there's no URL anywhere.
    Even if I manually add a podcast by choosing "Subscribe to podcast" from the Advanced menu, then entering the podcast URL, if I thereafter try to retrieve that URL from somewhere in the downloaded podcast, it's nowhere to be found. Surely I'm missing something obvious. Now there are a very few podcasts that seem to put that info in their "Show Description" (aka the "Podcast Information" window) but they're the exception.
    Before you suggest control-clicking in the iTunes Music Store and choosing "Copy iTunes Music Store URL," note that that doesn't get close to the mark at all, and besides, I need to do this for podcasts that aren't on the iTunes Music Store. Thanks!

    I should probably give an actual example to make myself clear. When you refer to clicking the "i," note that doing that is what I was talking about when I wrote: "there are a very few podcasts that seem to put that info in their 'Show Description' (aka the 'Podcast Information' window) but they're the exception." In other words, clicking the "i" opens the Podcast Information window. Same window opens if you choose "Show Description" from the contextual menu that opens when you control-click on the feed name.
    But the URL that appears in the Podcast Information window (besides not being selectable for copying and also being in a window that disappears if you switch apps), is just the link to the RSS page that lists ALL the episodes. It is not a link to a specific episode. What I want is the ability FROM A DOWNLOADED PODCAST EPISODE to extract the link for that specific episode. I guess this would be equivalent to clicking the "Get" button next to a dimmed episode that has not yet been downloaded, though I don't really care that clicking that link (if I could find it) wouldn't automatically download the episode into iTunes for the person to whom I would send the link.
    So, for example, the link that I can extract from the KCRW On the Beat podcast is this:
    feed://ax.phobos.apple.com.edgesuite.net/WebObjects/MZStore.woa/wa/podcastRSS?id =73331691
    But what I want is to get the link (from within iTunes, not by visiting the web page) of the "Our Pop Stars Lead Us" episode, which is here:
    http://66.186.18.80/podcast/mp3/ob/ob050907Afterthe_DelugeOur.mp3
    See what I mean?

  • Infopath throws error "only specific pattern allowed" when use regular expression for validation in schema

    This is MS info path question, I could not find specific forum for Info-Path So asking my question here
    I am creating Info-Path form from schema. In the schema, the filename has restriction that it can only have extension .pdf or .PDF. But while filling out the form even if I type filename with extension ".pdf", I still see error "only
    specific pattern allowed".
    Below is my schema I used to create form
    <?xml version="1.0" encoding="utf-8" ?>
    <xs:schema elementFormDefault="qualified" xmlns:xs="http://www.w3.org/2001/XMLSchema">
    <xs:element name="Document">
    <xs:complexType>
    <xs:sequence>
    <xs:element name="FileName" type="FileNameType"/>
    </xs:sequence>
    </xs:complexType>
    </xs:element>
    <xs:simpleType name ="FileNameType">
    <xs:restriction base="xs:string">
    <xs:pattern value="^.*\.(pdf|PDF)$"/>
    <xs:minLength value="1" />
    <xs:maxLength value="128" />
    </xs:restriction>
    </xs:simpleType>
    </xs:schema>

    Hi
    This is the forum to discuss questions about Microsoft Office development. For your question, I recommend you post the question to the Answers forum for Infopath
    Microsoft Community for​ InfoPath​
    By the way, you can get support from here.  Support for Microsoft InfoPath
    Thank you for your understanding.
    Best Regards
    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click
    HERE to participate the survey.

Maybe you are looking for

  • Error 37 with iTunes

    iTunes reports error 37 when I try to restore my iPhone 3GS.  This phone was sent to me direct from Apple when I paid $200 to repair my last phone.  They could not repair my old phone so they sent this replacement.  This problem started when iTunes t

  • Source System Activation - IDOC Type does not exist

    I'm doing a new installation of BI7 and when I want to activate the source system on  replicate Metadata Box and select "Only Activate" it comes up with error stating :Basic Type ZSxxxxx does not exist When I look in SE16 on table RSBASIDOC I can see

  • Adding a soundcard with onboard sound.

    Is it possible to add a soundcard without disabling the onboard sound?  I'd like to use the card for recording and use the onboard for gaming, etc.  Is that possible?

  • How can I inform which program to use to open a Docx when it doesn't show in my dropdown list in attachments?

    When I attempt to open a Docx type file Thunderbird is attempting to open the document with an old version of Office (2003). I have upgraded to (2013). I have followed the suggestions of going to Tools, Options and Attachments to assign which program

  • Air Updater with Native applications

    I searched the forum for Application updater/ options available for updating our Air application when we use the air native applications. I know Air ApplicationUpdaterUI does not support native application updates (Air 2.0). I also observed that all