csv2sqlite | Ruby script to parse CSV file into a database | CSV Processing library
kandi X-RAY | csv2sqlite Summary
kandi X-RAY | csv2sqlite Summary
Ruby script to parse CSV file(s) into a sqlite database. Automatically generates the table schemas based on filenames, headers, and data types. NOTE: For an alterative implementation in python, see
Support
Quality
Security
License
Reuse
Top functions reviewed by kandi - BETA
Currently covering the most popular Java, JavaScript and Python libraries. See a Sample of csv2sqlite
csv2sqlite Key Features
csv2sqlite Examples and Code Snippets
Community Discussions
Trending Discussions on csv2sqlite
QUESTION
In my assessment I'm asked to write a shell script using only bash commands and another shell script using only SQL queries. These scripts should do the following: 1. Clean data in the .csv file (not important at the moment) 2. Sum up earnings based upon gender 3. Produce a simple HTML table
I have made the SQL query produce the correct numbers and HTML file, but with som help from other bash commands. For the file that should only contain bash commands I'm able to get the table but one of the numbers are wrong.
I'm very new to bash scripting and SQL queries so the code isn't very optimised.
The following is a shortned version of the sample input: CSV input
...ANSWER
Answered 2019-Aug-25 at 17:17#! /bin/bash
awk -F, '{
if (NR != 1)
{
if (sum[$13] == "")
{
sum[$13]=0
}
sum[$13]+=$5
}
}
END {
print ""
print "GenderTotal Amount [$]"
for ( gender in sum )
{
print ""gender"", ""sum[gender]""
}
print ""
}' table.csv
Community Discussions, Code Snippets contain sources that include Stack Exchange Network
Vulnerabilities
No vulnerabilities reported
Install csv2sqlite
On a UNIX-like operating system, using your system’s package manager is easiest. However, the packaged Ruby version may not be the newest one. There is also an installer for Windows. Managers help you to switch between multiple Ruby versions on your system. Installers can be used to install a specific or multiple Ruby versions. Please refer ruby-lang.org for more information.
Support
Reuse Trending Solutions
Find, review, and download reusable Libraries, Code Snippets, Cloud APIs from over 650 million Knowledge Items
Find more librariesStay Updated
Subscribe to our newsletter for trending solutions and developer bootcamps
Share this Page