Bash read file line by line, split by tab, send to java application -
i want read file line line, construct args string , use string start java application.
the file test.txt contains example lines, columns tab separated:
abc def ghj kln
asd ss fdf twe
#!/bin/bash ifs=$'\n' while read k d m s echo java -jar test.jar -k $k -d $d -a $a -m $m -s $s done < test.txt
unfortunatly not work. bash output broken:
-k abc def ghj kln -d -a -m -s
you columns tab separated, should use \t
ifs
instead of \n
means newline:
ifs=$'\t'
(assuming each line of input contains values k
, d
, a
, m
, s
separated tabs).
Comments
Post a Comment