Unix command to pass a Variable as Interval of a for loop

Viewed 14

The directory is like this: Parser-main->xmltest->sample

Here this is working fine but instead of the the inteval "{1..2}" I want to give "{1..wc -l $FILE} So basically add the maximum lines of each file to the interval.

I have tried doing with a variable like len = $(wc -l $FILE) && for i in {1,$len} but it does not work.

Help is very much appreciated.

Parser-main/xmltest$ for FILE in *; do for i in {1..2}; do sed "1,$i d" $FILE > sample/$i && cd .. && ./main xmltest/sample/$i && rm xmltest/sample/$i && cd xmltest ;done;done;

0 Answers
Related