preproccing solr 21.11.2017

Version 1 - Updated on 21 Nov 2017 at 4:04AM by Joachim Hansen

Description

#!/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