Reputation: 986
If I have a file runtime.tsv
as
preprocessingTime_ms 1164
samplingTime_ms 17741
where the first space is a tab and the second is a space. How can I read samplingTime_ms
as an argument to pass on to java?
Basically I need to pass to java like
java -Xmx2g matching.PermutationESS\
--runtime 17741/1000
to execute in Mac command line.
Upvotes: 0
Views: 150
Reputation: 189648
Use a command substitution to interpolate the result of extracting the value from the input file.
java -Xmx2g matching.PermutationESS --runtime $(
awk -F '\t' '$1 == "samplingTime_ms" {
print $NF}' runtime.tsv)/1000
If the second line is space-separated, take out the -F '\t'
(this detail is a bit unclear in your question).
If you want the division to be calculated,
java -Xmx2g matching.PermutationESS --runtime $(
awk -F '\t' '$1 == "samplingTime_ms" {
print $NF/1000}' runtime.tsv)
Upvotes: 1