delimited-text

TSQL/SQL Server - table function to parse/split delimited string to multiple/separate columns

久未见 提交于 2019-12-12 04:37:21
问题 So, my first post is less a question and more a statement! Sorry. I needed to convert delimited strings stored in VarChar table columns to multiple/separate columns for the same record. (It's COTS software; so please don't bother telling me how the table is designed wrong.) After searching the internet ad nauseum for how to create a generic single line call to do that - and finding lots of how not to do that - I created my own. (The name is not real creative.) Returns: A table with

In Excel, using VBA — how do I import and insert data from a delimited file? (sample code & data)

这一生的挚爱 提交于 2019-12-11 22:14:59
问题 I've got a sheet setup with the following VBA: Sub PrintPDF() Application.DisplayAlerts = False ActiveSheet.ExportAsFixedFormat Type:=xlTypePDF, Filename:= _ "C:\Users\<insert_username>\Desktop\macro\Book1.pdf", Quality:=xlQualityStandard, _ IncludeDocProperties:=True, IgnorePrintAreas:=False, OpenAfterPublish:=False _ Application.Quit End Sub (which basically opens prints a PDF of the file and closes excel) Then I've got this in the workbook: Private Sub Workbook_Open() Run "PrintPDF" End

Check if the file has given number of columns [duplicate]

谁说胖子不能爱 提交于 2019-12-11 00:19:38
问题 This question already has answers here : Loop through file to count field number (3 answers) Closed last year . I have a few csv files that I need processing if the number of columns is 4 througout the file file_1 : 1,aa,bb,cc 2,dd,ee,ff 3,gg,hh,ii file_2 : 1,xx 2,yy 3,zz 4,xy I'm using awk for this for file in file_1 file_2 ... file_n do if [[ `awk -F"," 'NF==4' $file` ]] then #process else continue fi done I'm looking for a solution that Doesn't involve a subshell Checks for number of

Remove carriage return from text file

 ̄綄美尐妖づ 提交于 2019-12-08 11:21:09
问题 I have a text file that is | delimited and is over 59,000 line long. How can I remove the carriage returns so each line is one record? Here is what the current file looks like:- Here is what I need it to look like:- Any help would be awesome 回答1: Do a regular expression find/replace like this: Open Replace Dialog Find What: [^|\n\r]\R Replace With: \1 check regular expression click Replace or Replace All It matches OS-linebreaks ( \R ) that are not ( ^ ) preceded by a | or \r or \n . Should

Can't Separate Text File By Delimiter |

怎甘沉沦 提交于 2019-12-07 17:11:02
问题 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.ini file but it isn't working. Here is my schema file. [MyTextFile.CSV] Format=Delimited(|) ColNameHeader=False Col1=fullstockn Text col2=FULLINFO Text MaxScanRows=0

Convert .csv file into Excel in VBScript

倖福魔咒の 提交于 2019-12-06 15:10:29
问题 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)

Multiple delimiters in column headers also separates the row values

亡梦爱人 提交于 2019-12-06 05:41:05
I had a some issue about defining multiple seperator when reading a file. It is originally solved in my previous post reading-files-with-multiple-delimiter-in-column-headers-and-skipping-some-rows thanks to @piRsquared When I looked in detail to my real data I realized that some columns have .cd or .dvd extensions and when I applied the solution above they are also separated as a new column and the solution above started not to work! b.txt skip1 A1| A2 |A3 |A4# A5# A6 A7| A8 , A9 1,2,3,4,5.cd,6,7,8.dvd,9 1,2,3,4,5.cd,6,7,8.dvd,9 1,2,3,4,5.cd,6,7,8.dvd,9 END123 Some other data starts from here

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

折月煮酒 提交于 2019-12-05 09:26:36
问题 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 into a string string and passing them off to my Encryption method I have. After I decrypt them I need to be able to reliably separate them. I'm using C# if it

Convert text file into a comma delimited string

ぐ巨炮叔叔 提交于 2019-12-05 02:35:51
问题 I don't seem to locate an SO question that matches this exact problem. I have a text file that has one text token per line, without any commas, tabs, or quotes. I want to create a comma delimited string based on the file content. Input: one two three Output: one,two,three I am using this command: csv_string=$(tr '\n' ',' < file | sed 's/,$//') Is there a more efficient way to do this? 回答1: The usual command to do this is paste csv_string=$(paste -sd, file.txt) 回答2: One way with Awk would be

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

筅森魡賤 提交于 2019-12-04 22:24:15
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 into a string string and passing them off to my Encryption method I have. After I decrypt them I need to be able to reliably separate them. I'm using C# if it matters. | would be next on my list and is often used as an alternative to CSV. google "pipe delimited" and