hi
I have a text file abc.txt as below
a = 0
b = 1
c = 3
i want to interpret this file i.e. if number corresponding to 'a' is 0 i want to run a script script.bash .
How do do that?
hi
I have a text file abc.txt as below
a = 0
b = 1
c = 3
i want to interpret this file i.e. if number corresponding to 'a' is 0 i want to run a script script.bash .
How do do that?
while read a b c
do
if [ "$a" = a ] && [ "$c" = 0 ]
then
script.bash
fi
done < abc.txt
thanks a lot
i still have another problem in getting exactly what i want
this is how i get the file abc.txt
tail -3 file1.txt| awk '{print $5 " " "=" " " $NF}' > abc.txt
so when i try
while read a b c
do
if [ "$c" = 0 ]
then
#### do something
fi
done <abc.txt
it attaches '\r' with $c in file abc.txt i.e. 0 becomes '0\r' and so on
thus the comparison fails.
---------- Post updated at 02:41 PM ---------- Previous update was at 02:39 PM ----------
above problem occurs only when i generate abc.txt as shown above.
If i type the contents of abc.txt by myself it works fine
please advise
Remove the carriage returns:
tail -3 file1.txt |
awk '{ gsub( "\r", "", $NF)
print $5 " " "=" " " $NF}' > abc.txt
it helped...thanks a lot