Last active
November 13, 2015 02:37
-
-
Save DecisionNerd/e42d51af0679acb8a2ad to your computer and use it in GitHub Desktop.
Revisions
-
DecisionNerd revised this gist
Nov 13, 2015 . 1 changed file with 5 additions and 2 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -4,6 +4,9 @@ # first line of the file. This script processes csv files in the directory # where it is executed. Script runs continuously until stopping with ctrl+Z #specify directory to send files for ingest (without trailing /) DEST=/home/user/Test/forIngest echo "processing csv files in $(pwd) for ingest by logstash..." while true do @@ -16,9 +19,9 @@ do echo "removing header row of $file" # remove the first line in the csv file sed -i 1d $file echo "moving edited $file to $DEST" # move file to where logstash will grab mv $file $DEST echo "waiting on csv files..." # only run command every second sleep 1 -
DecisionNerd created this gist
Nov 13, 2015 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,28 @@ #!/bin/bash # ingesting csv files into logstash requires removal of the header row in the # first line of the file. This script processes csv files in the directory # where it is executed. Script runs continuously until stopping with ctrl+Z echo "processing csv files in $(pwd) for ingest by logstash..." while true do # if there are csv files in the current directory if [ -a $(pwd)/*.csv ] then # select each csv file in the current directory for file in $(pwd)/*.csv do echo "removing header row of $file" # remove the first line in the csv file sed -i 1d $file echo "moving edited $file to /home/user/Test/forIngest" # move file to where logstash will grab mv $file /home/user/Test/forIngest echo "waiting on csv files..." # only run command every second sleep 1 done #else fi done