delimited-text

What is the fastest way to parse text with custom delimiters and some very, very large field values in C#?

I've been trying to deal with some delimited text files that have non standard delimiters (not comma/quote or tab delimited). The delimiters are random ASCII characters that don't show up often between the delimiters. After searching around, I've seem to have only found no solutions in .NET will suit my needs and the custom libraries t...

Text file to array using VBScript and ";" seperator.

I have a rather large list of data that contains 5 properties per element. The elements are separated by a ";". I want to read the elements into an array in VBScript. Seems simple enough to search for this on the big G but all clear examples assume you want to read line by line and then split the contents on a line on a ";" character. I ...

How can I best parse this comma delimited text file?

Hi, I am trying to figure out the best way to parse this comma delimited text file. Here is an excerpt: bldgA, fred, lunch bldgA, sally, supper bldgB, bob, parking lot bldgB, frank, rooftop ... What I am trying to do is read "bldgA" and then I want the person (2nd column), "fred" for example. But I don't want to parse the file look...

Can't Separate Text File By Delimiter |

Hello, I am using C#. I am trying to pull in a text file to an object. I am using an ODBC connection and it looks like this Driver={Microsoft Text Driver (*.txt; *.csv)};Dbq=C:\Users\Owner\Desktop\IR\IR_Files\Absolute;Extensions=asc,csv,tab,txt; I am able to make the connection but I can't get my columns separated. I'm using a schema...

Least used delimiter character in normal text < ASCII 128

For coding reasons which would horrify you (I'm too embarrassed to say), I need to store a number of text items in a single string. I will delimit them using a character. Which character is best to use for this, i.e. which character is the least likely to appear in text? Must be printable and probably less than 128 in ASCII to avoid lo...

C# regex to match a string which has a delimiter

I need some help with regex. i want to get the string which has a delimiter in it between two specific words. e.g. i need a regex which matches: Statements1 start Statements2 ; Statements3 end fun; There can be multiple occurences of ' ; ' between 'start' and 'end'. Statements are multiple words where (.*) can be used in the regex f...

C# regex to replace a delimiter by another one

I'm working on pl/sql code where i want to replace ';' which is commented with '~'. e.g. If i have a code as: --comment 1 with; select id from t_id; --comment 2 with ; select name from t_id; /*comment 3 with ;*/ Then i want my result text as: --comment 1 with~ select id from t_id; --comment 2 with ~ select name from t_id; /*com...

Regex to find strings contained between separators

in this text : text text text [[st: aaa bbb ccc ddd eee fff]] text text text text [[st: ggg hhh iii jjj kkk lll mmm nnn]] text text text I'm trying to get the text between the [[st: and that ends with ]] My program should output: aaa bbb ccc ddd eee fff (first match) ggg hhh iii jjj kkk \n lll mmm nnn(second match) But I can on...

How do I handle every ASCII character (including regex special characters) in a Perl regex?

I have the following code in Perl: if (index ($retval, $_[2]) != -1) { @fs = split ($_[2], $_[1]); $_[2] is the delimiter variable and $_[1] is the string that the delimiter may exist in. ($_[0] is used elsewhere) You may have guessed that this code is in a subroutine by those variable names. Anyway, onto my question, when my del...

copying from a tab delimited text file to itself

I have a tab delimited text file as so : name \t loan period \t loan amount John \t 5 years \t 6000 Sarah \t 5 years \t 6000 Jane \t 1 month \t 100 I'm looking to copy the lines where "loan period" = "5 years" to where "loan period" = "1 month", in order to show the comparison. The new lines would be appended at...

What is a more unique delimiter than comma for separating strings?

I have several textboxes where users can enter information into them. This can include commas, so I can't use the standard comma delimited strings. What is a good delimiter to denote that strings should be separated based on that character that isn't typically used by users in their writings? I'm going to be combining these fields int...

How to split single quoted comma delimited values containing commas in Ruby

Say I have a string with comma delimited values enclosed in single quotes that may or may not include commas, like this: "'apples,bananas','lemons'" and I want to split that into an array ["apples,bananas", "lemons"] Apparently, if I split(',') the string I get [ "'apples", "bananas'", "lemons" ] which I don't understand. The o...

Delimiting User Input

What is the best character to use to delimit user input? For example if a user has an infinite number of textboxes to type things into, but each textbox's value will be concatenated into a single database field, what is the safest character to delimit each input? I think it should be a character not on your typical keyboard. Is there a...

How to split a user-generated string which may contain the delimitter?

I'd like to String.Split() the following string using a comma as the delimitter: John,Smith,123 Main Street,212-555-1212 The above content is entered by a user. If they enter a comma in their address, the resulting string would cause problems to String.Split() since you now have 5 fields instead of 4: John,Smith,123 Main Street, Apt...

Getting a comma-delimited list of PK's for duplicates of a record in SQL Server 2005?

This is an off-shoot of a previous question I had: http://stackoverflow.com/questions/1544314/a-little-fuzzy-on-getting-distinct-on-one-column This query makes a little more sense, given the data: SELECT Receipts.ReceiptID, FolderLink.ReceiptFolderID FROM dbo.tbl_ReceiptFolderLnk AS FolderLink INNER JOIN dbo.tb...

Is there a standard format for describing a flat file?

Is there a standard or open format which can be used to describe the formating of a flat file. My company integrates many different customer file formats. With an XML file it's easy to get or create an XSD to describe the XML file format. I'm looking for something similar to describe a flat file format (fixed width, delimited etc). S...

Javascript: quick script to line up pipe-delimited text (or any-character-delimited text)

Background: I've written this before but I don't like the approach. The reason is because Javascript does not have "sprintf" and that is something I use heavily if the language supports it. Question: How would you use javascript to go from BEFORE to AFTER? If anyone has a solution with very small number of lines of code, or something fr...

Viewing delimited columns in emacs

Is anyone aware of an emacs mode or function that will reformat a buffer holding a delimited file such that each delimiter (e.g. tab) defines a "column" with the width of each column set to the longest entry? I can reset the tab-width variable but that makes all columns equal width. I would much prefer variable-width columns if possible...

Can I define flex tokens during runtime?

I'd like to use lex/yacc to read in a delimited text file. This would be pretty trivial stuff for a parser, but different text files have different delimiters, so I'd like to let the user specify whether the text is separated by tabs, spaces, commas, pipes, unicode snowmen, et cetera. The normal means of using these tools is to write a ...

Space Delimited 'Export To Text' Excel Macro Issue

I have the below vba macro to Export the selected cells into a text file. The problem seems to be the delimiter. I need everything to be in an exact position. I have each column's width set to the correct width(9 for 9 like SSN) and I have the cells font as Courier New(9pt) in an Excel Sheet. When I run this it comes out REALLY c...