recentpopularlog in

kme : csv   61

How to add separator in powershell - Stack Overflow
Basically, use 'export-csv' or 'converto-csv' with a '-delimiter' option.
csv  windows  powershell  shellscripting  textprocessing  newbie  solution 
january 2020 by kme
GitHub - alex/csv-sql: Query your CSV files with SQL
Query your CSV files with SQL. Contribute to alex/csv-sql development by creating an account on GitHub.
csv  sql  datamining  commandline  rust  textprocessing 
june 2019 by kme
BurntSushi/xsv: A fast CSV command line toolkit written in Rust. -
A fast CSV command line toolkit written in Rust. Contribute to BurntSushi/xsv development by creating an account on GitHub.
rust  csv  textprocessing  commandline 
april 2019 by kme
RFC 4180 - Common Format and MIME Type for Comma-Separated Values (CSV) Files |
(2.5) Each field may or may not be enclosed in double quotes (however some programs, such as Microsoft Excel, do not use double quotes at all). If fields are not enclosed with double quotes, then double quotes may not appear inside the fields.

(2.7) If double-quotes are used to enclose fields, then a double-quote appearing inside a field must be escaped by preceding it with another double quote.
rfc  csv  format  spec  commaseparated  delimitedfile  fileformat  reference 
april 2019 by kme
A stupid proposal: fill stackexchange with Miller · Issue #212 · johnkerl/miller |
Miller is like awk, sed, cut, join, and sort for name-indexed data such as CSV, TSV, and tabular JSON - johnkerl/miller
textprocessing  importexport  conversion  delimitedtext  tabdelimited  csv  miller  sampleusage  needshelp 
january 2019 by kme
curl - Download/Export Public Google Spreadsheet as TSV from Command Line? - Stack Overflow -
There's no really good answer in this thread, but here's the gist:

<code class="language-bash">
# the ID from the sharing URL

# 0 for first sheet; for others, find this ID by switching to
# sheet and looking for '#gid=NUMBER' in browser's address bar

# 'csv' and 'tsv' both work; 'docx' and others may work, too

# same as 'wget -O -'; outputs to stdout
curl "$SHAREID/export?gid=$SHEETID&format=$FORMAT"

# save some other sheet (gid=8675309) as a tab-delimited local file,
# using filename from the remote end (-OJ)
curl -LOJ "$SHAREID/export?gid=$SHEETID&format=$FORMAT"
google  googlesheets  gsheets  cli  curl  commandline  api  csv  importexport  solution  googledocs  tabdelimited 
january 2019 by kme
linux - Rearrange columns using cut - Stack Overflow |
'cut' can't, use AWK:
Use awk instead:
<code class="language-bash">awk '{ print $2 " " $1}' file.txt</code>
unix  textprocessing  csv  tabdelimited  annoyance  workaround  solution 
october 2018 by kme
How to import CSV file to MySQL table - Stack Overflow |

phpMyAdmin can handle CSV import. Here are the steps:

1. Prepare the CSV file to have the fields in the same order as the MySQL table fields.
2. Remove the header row from the CSV (if any), so that only the data is in the file. (not necessary --Ed.)
3. Go to the phpMyAdmin interface.
4. Select the table in the left menu.
5. Click the import button at the top.
6. Browse to the CSV file.
7. Select the option "CSV using LOAD DATA".
8. Enter "," in the "fields terminated by".
9. Enter the column names in the same order as they are in the database table.
10. Click the go button and you are done.

This is a note that I prepared for my future use, and sharing here if someone else can benefit.
database  dba  mysql  import  automation  csv  tabdelimited  solution  importexport 
january 2018 by kme
GitHub - vim-scripts/csv.vim: A Filetype plugin for csv files. |
Check out :ArrangeColumn and :UnArrangeColumn. These allow you to use vertical selections to prepend/append to individual columns. Pretty handy! link:

<code class="language-vim">
" create this as ~/.vim/filetype.vim
if exists("did_load_csvfiletype")
let did_load_csvfiletype=1

augroup filetypedetect
au! BufRead,BufNewFile *.csv,*.dat,*.tab,*.bed setfiletype csv
augroup END
Syntax error when opening a CSV file

If you see this error:

<code>CSV Syntax:Invalid column pattern, using default pattern \%([^,]*,\|$\)</code>

This happens usually, when the syntax script is read before the filetype plugin, so the plugin did not have a chance to setup the column delimiter correctly.

The easy way to fix it, is to make sure the :syntax on (:syn-on) statement comes after the :filetype plugin (:filetype-plugin-on) statement in your .vimrc

Alternatively, you can simply call InitCSV and ignore the error.
Autocommand on opening/closing files

Alternatively, you can restrict this setting to files below a certain size. For example, if you only want to enable this feature for files smaller than 1 MB, put this into your .vimrc

let g:csv_autocmd_arrange = 1
let g:csv_autocmd_arrange_size = 1024*1024
vim  script  csv  syntaxhighlighting  programming  plugin  delimitedtext  textprocessing  errormessage  essential  movein  solution 
october 2017 by kme
perl - How can I convert my JSON to CSV using jq? - Stack Overflow |
Building upon Joe Harris' answer, you can use the @csv filter so that strings are properly quoted and escaped when necessary :

jq -r '[.case, .custom."speech invoked", .custom."input method"] | @csv'
jq  json  csv  importexport  textprocessing  webdevel  solution 
october 2017 by kme
sqlite - How to import a tsv file with SQLite3 - Stack Overflow
There is actually a dedicated mode for importing tab separated files:

sqlite> .mode tabs
sqlite> .import data.tsv people

Also if you include a header row in your tsv file, you can let sqlite automatically create the table. Just use an unused table-name during import and change the tsv file to:

name param1 param2
Bob 30 1000
Wendy 20 900
sqlite  importexport  tabdelimited  csv  solution 
june 2017 by kme
unix - How to delete a column/columns of a CSV file which has cell values with a string enclosed in double quotes - Stack Overflow

I had the same issue as you Dhruuv, the solution proposed by jaypal singh is correct but wasn't working for all my cases. I recommend you to use : (Enables common unix utlities like cut, head, tail to work correctly with csv data containing delimiters and newlines) this worked for me.
csv  textprocessing  delimiter  solution 
april 2017 by kme
Text Import Wizard - Excel
This has moved from File -> Import to the "Data" tab recently:
To start the Text Import Wizard, on the Data tab, in the Get External Data group, click From Text. Then, in the Import Text File dialog box, double-click the text file that you want to import.
excel  autoformat  autocorrect  annoyance  importexport  tsv  csv  solution 
december 2016 by kme
CSV files in Vim
Unfortunately I ran into a little configuration problem before I got this plugin up and running, being confronted with the following error message after opening a CSV file:

CSV Syntax:Invalid column pattern, using default pattern \%([^,]*,\|$\)

The error message comes from the syntax file in the CSV plugin, and it boils down to the fact that the filetype plugin for CSV files was not loaded yet. When looking at my .vimrc, you see why:

syntax enable
filetype on
filetype plugin on
filetype indent on

The syntax should be enabled after enabling the filetype plugins, so the error message disappeared with the following modification:

filetype on
filetype plugin on
filetype indent on
syntax enable

And now I can look at pretty CSV files on my console.
vim  csv  texprocessing  plugin  errormessage  solution 
october 2016 by kme
Import CSV File Into MySQL Table
The following statement imports data from the c:\tmp\discounts.csv file into the discounts table.
LOAD DATA INFILE 'c:/tmp/discounts.csv'
INTO TABLE discounts

LOAD DATA INFILE 'c:/tmp/discounts.csv'
INTO TABLE discounts
mysql  importexport  csv  dba  database  solution 
july 2016 by kme
shell - How do I split a string on a delimiter in Bash? - Stack Overflow
You can set the internal field separator (IFS) variable, and then let it parse into an array. When this happens in a command, then the assignment to IFS only takes place to that single command's environment (to read ). It then parses the input according to the IFS variable value into an array, which we can then iterate over.
<code class="language-bash">

IFS=';' read -ra ADDR <<< "$IN"
for i in "${ADDR[@]}"; do
# process "$i"

It will parse one line of items separated by ;, pushing it into an array. Stuff for processing whole of $IN, each time one line of input separated by ;:

<code class="language-bash">
while IFS=';' read -ra ADDR; do
for i in "${ADDR[@]}"; do
# process "$i"
done <<< "$IN"
Taken from Bash shell script split array:

<code class="language-bash">
arrIN=(${IN//;/ })

Explanation: This construction replaces all occurrences of ';' (the initial // means global replace) in the string IN with ' ' (a single space), then interprets the space-delimited string as an array (that's what the surrounding parentheses do).
bash  arrays  shellscripting  solution  delimited  csv  textprocessing 
march 2016 by kme
parsing - How can I read and parse CSV files in C++? - Stack Overflow
You can use the bcp utility that comes with boost to extract only the headers you actually need.
cplusplus  streams  stl  boost  textprocessing  parsing  csv  maybesolution 
june 2015 by kme
Introducing Tabula - Features - Source: An OpenNews project
Today we’re pleased to announce the initial public release of Tabula, a collaboration born out of these previously separate projects. Tabula is free and available under the MIT open-source license. Tabula lets you upload a (text-based) PDF file into a simple web interface and magically pull tabular data into CSV format.
computervision  webapp  csv  converter  pdf  ProjectstoWatch 
april 2013 by kme

Copy this bookmark:

to read