#!/bin/bash
# Have to be run as full path to output folder (ending with /) as command line argument 1
# Have to be run in the same current working folder (PWD) as the batch files to be preproccesed
currDir=$(pwd);
for f in $(ls -p | grep -v '/');
do
fileToBePreproccesed="$currDir/$f";
outputPath="$1$f";
cat $fileToBePreproccesed | sed -e 's/^/{"content":"/' | awk 'NF{print $0 " \"},"}' | awk 'BEGIN{print "[";}{print;}' |head -n -1 | awk 'END { print "]";}{print;}' >> $outputPath;
done