Sei sulla pagina 1di 1

1. what if there are 2 fields in the text file?

ie.
20 dummy1
25 dummy2
.. ..
How to read each line and assign these 2 fields into 2 variables?
Sol:
cat $TESTFILE | while read FIELD1 FIELD2
do
echo "Field 1 is $FIELD1, Field 2 is $FIELD2"
done
The shell will split the line based on your field separator, and put each field into the
variables named. If there are more fields than variables, the last named will contain
the rest of the line.
2 Add Days to Date
Sol :
date -d "+5 day" +"%D ?
d1=$next_run_date-last_run_date "+%s"
d2=$last_run_date "+%s"
d3=(d2-d1)/864000
echo $d3 days dif

Potrebbero piacerti anche