Combining text files with Execute command
Posted: Tue Aug 08, 2017 9:50 pm
We're receiving several .csv files from a client that need to be combined into one by adding the contents of the second file after the contents of the first. I've been trying to use cat in the Execute Command element but am having trouble getting it to work in Switch. In the Mac terminal "cat file2.csv >> file1.csv" gives me what we need, but switch is producing no output when I drag file2.csv and file1.csv into the flow.
Tried a bunch of variations, but the execute command is currently set up like this
Command or path
/path/to/script/cat.sh
Arguments
"%1" "%2"
Output
File at path
Copy Input: No
Output extension: Auto
Disregard exit code
Bash Script
cat.sh
#!/bin/bash
cat "${1}" >> "${2}"
Permissions are 755 on the cat.sh bash script. Also tried running it direct with the cat command in place instead of the path to the separate script file.
Any ideas. I've gotten sed and awk commands to work in similar scripts through trial and error in the past. I'm wondering if it's not presenting file1.csv correctly as the output at %2. Getting everything in the right place in Execute is a pain.
Tried a bunch of variations, but the execute command is currently set up like this
Command or path
/path/to/script/cat.sh
Arguments
"%1" "%2"
Output
File at path
Copy Input: No
Output extension: Auto
Disregard exit code
Bash Script
cat.sh
#!/bin/bash
cat "${1}" >> "${2}"
Permissions are 755 on the cat.sh bash script. Also tried running it direct with the cat command in place instead of the path to the separate script file.
Any ideas. I've gotten sed and awk commands to work in similar scripts through trial and error in the past. I'm wondering if it's not presenting file1.csv correctly as the output at %2. Getting everything in the right place in Execute is a pain.