delimited-text

Convert .csv file into Excel in VBScript

主宰稳场 提交于 2019-12-04 21:18:31
I'm writing a program to convert a .csv file into an Excel file in VBScript. This is the portion of my .csv file (It has a header as well) Report Title,Goods Performance Characteristics Report,,Report Title,Goods Performance Characteristics Report,,,,,,, Begin Date,8/7/2012,,,,,,,,,, Template Name,XXXX-Test-VVV-Two-Positions,,,,,,,,,, Total Productions,,,,,,,,,,, ,ID,Name,Product Description,Issue Date,Product Type,Weight (kg),Weight (lb),Price,Product volume, Profit,Total Value (000) ,315616102,Lux Honey,Body Wash,8/1/2012,C,0.06,0.06,93,793920,0,7455703038 ,579780206,Clear AntiDandruf

Ruby : How can I detect/intelligently guess the delimiter used in a CSV file?

我的梦境 提交于 2019-12-04 08:17:36
I need to be able to figure out which delimiter is being used in a csv file (comma, space or semicolon) in my Ruby project. I know, there is a Sniffer class in Python in the csv module that can be used to guess a given file's delimiter. Is there anything similar to this in Ruby ? Any kind of help or idea is greatly appreciated. Looks like the py implementation just checks a few dialects: excel or excel_tab. So, a simple implementation of something that just checks for "," or "\t" is: COMMON_DELIMITERS = ['","',"\"\t\""] def sniff(path) first_line = File.open(path).first return nil unless first

create a delimited text in c# with separate columns

…衆ロ難τιáo~ 提交于 2019-12-02 18:01:10
问题 I've been trying to create a tab limited text file in c# so that the data are properly shown in separate columns. Firstname Lastname Age John Smith 17 James Sawyer 31 I have tried the "\t" character but all I get is this: Firstname Lastname Age John Smith 17 James Sawyer 31 Here is my code: string[,] P = new string[2, 3] { { "John", "Smith", "17" }, { "James", "Sawyer", "31" } }; using (StreamWriter s_w = new StreamWriter(target)) { s_w.WriteLine("Firstname \t Lastname \t Age"); for (int i =

How to parse a comma delimited string when comma and parenthesis exists in field

感情迁移 提交于 2019-12-02 01:28:54
I have this string in C# adj_con(CL2,1,3,0),adj_cont(CL1,1,3,0),NG, NG/CL, 5 value of CL(JK), HO I want to use a RegEx to parse it to get the following: adj_con(CL2,1,3,0) adj_cont(CL1,1,3,0) NG NG/CL 5 value of CL(JK) HO In addition to the above example, I tested with the following, but am still unable to parse it correctly. "%exc.uns: 8 hours let @ = ABC, DEF", "exc_it = 1 day" , " summ=graffe ", " a,b,(c,d)" The new text will be in one string string mystr = @"""%exc.uns: 8 hours let @ = ABC, DEF"", ""exc_it = 1 day"" , "" summ=graffe "", "" a,b,(c,d)"""; string str = "adj_con(CL2,1,3,0),adj

Using CROSS APPLY for more than one column

廉价感情. 提交于 2019-12-01 10:53:04
Day #3 with SQL Server. I am trying to combine 2 columns of delimited data into one output from a Table Valued Function. Here is my data: I would like the data to be processed and placed into a table in the following format: I am currently trying to use this CROSS APPLY TSQL statement, but I don't know what I'm doing. USE [Metrics] INSERT INTO dbo.tblSplitData(SplitKey, SplitString, SplitValues) SELECT d.RawKey, c.*, e.* FROM dbo.tblRawData d CROSS APPLY dbo.splitstringcomma(d.DelimitedString) c, dbo.splitstringcomma(d.DelimitedValues) e My research on CROSS APPLY has broad context, and I don

A better way to parse integer values from a T-SQL delimited string

血红的双手。 提交于 2019-12-01 10:11:30
问题 I have a SQLServer2008 R2 Stored Procedure that contains an algorithm for parsing out integers from a delimited string. Here's an example of the SQL code that I made for looping through the delimited string and extracting any numbers that may exist in the delimited string: -- Create a delimited list for testing DECLARE @NumericList nvarchar(MAX) = N'1, 33,44 ,55, foo ,666,77 77,8,bar,9,10' -- Declare the delimiter DECLARE @ListDelimiter VARCHAR(1) = ',' -- Remove white space from the list SET

Using CROSS APPLY for more than one column

笑着哭i 提交于 2019-11-30 20:02:58
问题 Day #3 with SQL Server. I am trying to combine 2 columns of delimited data into one output from a Table Valued Function. Here is my data: I would like the data to be processed and placed into a table in the following format: I am currently trying to use this CROSS APPLY TSQL statement, but I don't know what I'm doing. USE [Metrics] INSERT INTO dbo.tblSplitData(SplitKey, SplitString, SplitValues) SELECT d.RawKey, c.*, e.* FROM dbo.tblRawData d CROSS APPLY dbo.splitstringcomma(d.DelimitedString

Least used delimiter character in normal text < ASCII 128

纵然是瞬间 提交于 2019-11-28 21:56:14
问题 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 the text? Must be printable and probably less than 128 in ASCII to avoid locale issues. 回答1: Assuming for some embarrassing reason you can't use CSV I'd say go with the data. Take some sample data, and do a simple character count

Reading data from text file and delimiting

梦想与她 提交于 2019-11-28 04:19:53
问题 I have an Excel 2010 spreadsheet, and I am reading in information from a .txt file (and another .xls file in future). This text file has 3 elements per row; firtname, surname and Job title, and each element is separated by a comma. I have the data reading and pasting into Excel, however each row is pasted into the one cell. I am looking to paste each element into different columns. I know that I should try and delimit, but I just can't figure out the syntax. My question is how do I separate

Group subarrays by one column, make comma-separated values from other column within groups

南楼画角 提交于 2019-11-28 02:24:38
I have a array that looks like this: $array = [ ["444", "0081"], ["449", "0081"], ["451", "0081"], ["455", "2100"], ["469", "2100"] ]; I need to group as a new array that looks like: array ( 0 => array ( 0 => '444,449,451', 1 => '0081', ), 1 => array ( 0 => '455,469', 1 => '2100', ), ) I'd tried many scripts, but with no success. function _group_by($array, $key) { $return = array(); foreach($array as $val) { $return[$val[$key]][] = $val; } return $return; } $newArray = _group_by($array, 1); // (NO SUCCESS) Giedrius There should be more elegant solutions, but simplest one I can think of would