Merge multiple csv files with grunt shell

47 views Asked by At

I'm trying to merge multiple csv files using grunt-shell with the following code:

var command1 = 'cat <(cat file1.csv) <(tail -n+2 file2.csv) > file3.csv';

grunt.initConfig({
    shell: {
           mergeFile1: function(grunt) {
               return command1;
           }
    }
});     

I tried running this task but everytime I got the following error:

Syntax error: "(" unexpected

but when I tried to run this command directly from the command line, it worked. So far, I've come to realise that grunt shell uses #!/bin/sh and the above command requires #!/bin/bash. I tried the above command in a .sh file with the header, #!/bin/sh, and still got the same error when executing the file using ./test.sh and it was working when I used #!/bin/bash.

Any suggestions?

0

There are 0 answers