I have file test.txt and file contains some lines So i have to add "done" at the end of the word once the verification is done, Initial text file
test.txt
abc
bcd
cde
expected output
test.txt
abc DONE
bcd DONE
cde DONE
Below is the code i am using
k=0
for i in `cat test.txt`
do
if [[ $k -le 5 ]];
then
echo $i >> XYZ
k=`expr $k + 1`
sed '/$i/a "DONE"' test.txt
fi;
done
But i couldn't see any changes in test.txt. Any idea how to do