Kindly help me to use 2 variables with for condition.For example,cat days010720170207201703072017cat hours00:0001:0002:0003:00my shell script sample for i in `cat days` & j in `cat hours`    do    cat file | grep $i $j >data-$i-$j    doneI want an output of 3 days * 4hours = 12 files redirected with corresponding data-day-hourplease help.
Shell: how to use 2 variables with for condition
bash;shell script;variable
You need to use a nested for loop       for i in `cat days`       do         for j in `cat hours`        do        cat file | grep  $i $j  >data-${i}-${j}      done    done