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

Popular posts from this blog

sql - invalid in the select list because it is not contained in either an aggregate function -

Angularjs unit testing - ng-disabled not working when adding text to textarea -

How to start daemon on android by adb -