Code Monkey home page Code Monkey logo

csvprintf's People

Contributors

archiecobbs avatar catboxparadox avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

csvprintf's Issues

Group option

I think it would be useful if there was a group option. You would specify a special group printf statement, and csvprintf would print this every time the group changes.

Example: given the input.csv:

Name,City,Email
Fred,New York,[email protected]
Lilly,New York,[email protected]
No Body,Cyberspace,[email protected]

And this will print a grouped list in MarkDown:

$ cat input.csv | csvprintf -ig '\n# %2$s\n' '- [%1$s](mailto:%3$s)\n'

# New York
- [Fred](mailto:[email protected])
- [Lilly](mailto:[email protected])

# Cyberspace
- [No Boddy](mailto:[email protected])

The CSV is expected to be sorted. Also, with -G a group footer can be specified. And optionally, with -g1 an additional level of grouping can be specified (a number is necessary, because per level, only a group header or footer needs to be specified). Also, this option would work nice with the XML option.

I thought up this option, because I wanted some kind of grouped output of a list of awesome CSV tools a friend of mine maintains, but awk wasn't up to the task...

Windows Cygwin Build Issues

Trying to build this in Cygwin on windows, iconv (devel) is certainly installed:
$ ./autogen.sh
cleaning up
running aclocal
running autoheader
running automake
Unescaped left brace in regex is deprecated, passed through in regex; marked by <-- HERE in m/${ <-- HERE ([^ \t=:+{}]+)}/ at /usr/bin/automake-1.14 line 3930.
configure.ac:41: installing 'scripts/compile'
configure.ac:21: installing 'scripts/install-sh'
configure.ac:21: installing 'scripts/missing'
Makefile.am: installing 'scripts/depcomp'
running autoconf

/cygdrive/d/logs/ad/csvprintf-master
$ ./configure
configure: loading site script /usr/share/config.site
checking for a BSD-compatible install... /usr/bin/install -c
checking whether build environment is sane... yes
checking for a thread-safe mkdir -p... /usr/bin/mkdir -p
checking for gawk... gawk
checking whether make sets $(MAKE)... yes
checking whether make supports nested variables... yes
checking whether make sets $(MAKE)... (cached) yes
checking for gcc... gcc
checking whether the C compiler works... yes
checking for C compiler default output file name... a.exe
checking for suffix of executables... .exe
checking whether we are cross compiling... no
checking for suffix of object files... o
checking whether we are using the GNU C compiler... yes
checking whether gcc accepts -g... yes
checking for gcc option to accept ISO C89... none needed
checking whether gcc understands -c and -o together... yes
checking for style of include used by make... GNU
checking dependency style of gcc... gcc3
checking for printf... /usr/bin/printf
checking for xsltproc... /usr/bin/xsltproc
checking for iconv_open in -lc... no
configure: error: required function iconv_open missing

/cygdrive/d/logs/ad/csvprintf-master
$ which iconv
/usr/bin/iconv

I found an old "fork" that used cygport to help with compiling I assume, the patch doesn't seem to work for me when I applied the changes directly to configure.ac.
https://github.com/fd00/yacp/blob/master/csvprintf/csvprintf-1.0.3-1bl1.src.patch

Option to use header entries as column names in xml

Consider your csv example, could you add an option '-u 1' that uses the first line of the csv as naming scheme for the xml output column names?

So for example the following output would happen

$ cat input.csv | csvprintf -ix -u 1
<?xml version="1.0" encoding="ISO-8859-1"?>
<csv>
  <row>
    <NAME>Fred Smith</NAME>
    <ADDRESS>1234 Main St.
Anytown, USA   39103</ADDRESS>
    <POINTS>123.4567</POINTS>
  </row>
  <row>
    <NAME>Wayne &quot;The Great One&quot; Gretsky</NAME>
    <ADDRESS>59 Hockey Lane</ADDRESS>
    <POINTS>999999</POINTS>
  </row>
</csv>

thanks a lot

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.