added various scripts

This commit is contained in:
Tobias Kessels
2017-09-18 11:47:26 +02:00
parent a1857f4a5b
commit 555d0ef695
25 changed files with 678 additions and 1 deletions

19
csv_get Executable file
View File

@@ -0,0 +1,19 @@
#!/bin/bash
#check if comma or semicolon
if [[ $( grep -c ',' $1 ) -gt $( grep -c ';' $1 ) ]]
then
delim=','
else
delim=';'
fi
file=$1
shift
#build cut
cut_cmd="cut -d${delim} -f"
#for option in $* ; do
#head -n1 $file | cut -d${delim} -f${option}
#done
cut_cmd="${cut_cmd}$(echo ${*} | tr ' ' ',') ${file}"
#echo ${cut_cmd%,}
$(echo $cut_cmd)