text-parsing

Modifying text files and executing programs with command line parameters in c# or c++ on Linux

I have a need to create a utility in Suze Linux. The utility will make modifications to some text files, and then use the information in those text files to program a device in the computer using a different executable which accepts command line parameters. I am fluent in c#, but have never worked with Linux. Should I take the time to...

What's the simplest way to extract the last section of an IP address?

I have an IP address which I want to grab the last chunk of as an integer. So from "192.168.1.150" I'd get 150. This is the code I'd concocted (I'm using C++/CLI), but somehow it feels rather clunky: String^ ipString = "192.168.1.150"; int lastDot = ipString->LastIndexOf('.'); int lastSection = int::Parse(ipString->Substring(lastDot, i...

Parsing a text file with a fixed format in Java

Suppose I know a text file format, say, each line contains 4 fields like this: firstword secondword thirdword fourthword firstword2 secondword2 thirdword2 fourthword2 ... and I need to read it fully into memory I can use this approach: open a text file while not EOF read line by line split each line by a space create a new ...

OSLO, ANTLR or other parser grammar, for parsing QUERY EXPRESSION

Greetings I'm working on a project that requires me to write queries in text form, then convert them to some easily processed nodes to be processed by some abiguous repository. Of everything there, the part I'm least interested is the part that converts the text to nodes. I'm hoping it's already done somewhere. Because I'm making stuff...

Parsing two-dimensional text

I need to parse text files where relevant information is often spread across multiple lines in a nonlinear way. An example: 1234 1 IN THE SUPERIOR COURT OF THE STATE OF SOME STATE 2 IN AND FOR THE COUNTY OF SOME COUNTY 3 UNLIMITED JURISDICTION ...

What is the best file format to parse?

Scenario: I'm working on a rails app that will take data entry in the form of uploaded text-based files. I need to parse these files before importing the data. I can choose the file type uploaded to the app; the software (Microsoft Access) used by those uploading has several export options regarding file type. While it may be insignific...

Help with parsing a log file (ANTLR3)

I need a little guidance in writing a grammar to parse the log file of the game Aion. I've decided upon using Antlr3 (because it seems to be a tool that can do the job and I figured it's good for me to learn to use it). However, I've run into problems because the log file is not exactly structured. The log file I need to parse looks lik...

Regular expression in C#

i have text something like this. @@MMIVLoader@[email protected]@BCM_7400S_LE@Product@Aug 21 2009@ @@MMIVLib@[email protected]@BCM_7400S_LE@Product@Aug 21 2009@ @@HuaweFGDLDrv@[email protected]@7324@PRODUCT@Aug 20 2009@ @@ProtectVer@[email protected] @BCM_SDE5.03@PRODUCT@Aug 4 2009 06:56:19@ @@KernelSw@[email protected]@BCM-7454@...

Text Parsing - My Parser Skipping commands

I'm trying to parse text-formatting. I want to mark inline code, much like SO does, with backticks (`). The rule is supposed to be that if you want to use a backtick inside of an inline code element, You should use double backticks around the inline code. like this: `` mark inline code with backticks ( ` ) `` My parser seems to skip o...

how to take input from a file in a certain way in C .

The way being suppose the data is 123 134 2312 32131 2131231 211212 It should take them as different numbers and store them in an integer array . ...

Get all characters from a string with their number

How in Java can I get list of all characters appearing in string, with number of their appearances ? Let's say we have a string "I am really busy right now" so I should get : i-2, a-2, r-2, m-1 and so on. ...

Code/Approach Golf: Find row in text file with too many columns

Given a text file that is supposed to contain 10 tab-delimited columns (i.e. 9 tabs), I'd like to find all rows that have more than 10 columns (more than 9 tabs). Each row ends with CR-LF. Assume nothing about the data, field widths, etc, other than the above. Comments regarding approach, and/or working code would be extremely appreci...

Parse custom tags to get attributes out for data parsing

HI there, I am looking for best practice or ideas for cleaning tags or at least grabbing the data from within custom tags in a text. I am sure I can code some sort of "parser" that will go through every line manually, but isnt there some smartere way today? Data thoughts: {Phone:555-123456789} here we have "phone" being the key...

Parse values from a string

How would you parse the values in a string, such as the one below? 12:40:11 8 5 87 The gap between numbers varies, and the first value is a time. The following regular expression does not separate the time component: str.split("\\w.([:]).") Any suggestions? ...

Uncertain separator, parsing a messy log with sed

Hello, I'm working on #huge# text files (from 100mb to 1gb), I have to parse them to extract some particoular data. The annoying thing is that the files have not a clearly defined separator. For example: "element" 123124 16758 "12.4" "element" "element with white spaces inside" "element" I have to delete the white spaces in strings l...

How do I move multiple parsed values from a log file to an Access Database? C#

I am working on a program that transfers a file from a CentOS VM, and parses the file for multiple Start, finish, and host ID values. After this the values are then moved into an Access database for tracking purposes. So far I am able to pull a file down from the CentOS VM and parse it for the desired values. However, I have run into a f...

Perl splitting text string (from HTML page, text document, etc.) by line into array?

This is kind of a weird question, at least for me, as I don't exactly understand what is fully involved in this. Basically, I have been doing this process where I save a scraped document (such as a web page) to a .txt file. Then I can easily use Perl to read this file and put each line into an array. However, it is not doing this base...

Looking for Open Source document to text parser recommendations (ex: .PDF or .doc or to text)

Formatting should be preserved. ...

Extended Log File Format Parser in Ruby

Hi, I'm looking for a ruby parser for the W3C Extended Log File Format. http://www.w3.org/TR/WD-logfile.html Ideally it would generate a multidimensional array based on the fields in the log file. I'm thinking something similar to how FasterCSV (http://fastercsv.rubyforge.org/) handles CSV files. Does anyone know if such a library ex...

Removing values from a list in python

I have a large file of names and values on a single line separated by a space: name1 name2 name3.... Following the long list of names is a list of values corresponding to the names. The values can be 0-4 or na. What I want to do is consolidate the data file and remove all the names and and values when the value is na. For instance, t...