I have a java program that takes time to execute and I have to make 10 runs of it and I am interested in only last 5 lines of the output, the actual output runs in hundreds of lines. Since I want to average the output I want tail -5 for run into a file. Also one of the parameters (--random) in my arguments keep changing in each run.
I am doing the following:
for i in {1..10} ; do cat output| tail -5 | java -cp src.Tagger.java --random $1; done
Sorry I am really bad at bash.
catto pipe intotail. Just saytail -5 output.--randomcome from? The code you have looks correct syntactically, but$1may not be the value you want to supply to--random.outputand feeds that as input to yourjavaprocess. Your description seems to say you want the last 5 lines of the output of yourjavaprocess, which would bejava -cp .... | tail -5.