I have a text file which has only integer values i.e different integers in different lines(say from 1 to 47). I have made a script that would read each line and take the value present in a different line. If the condition is met, then I want to echo a statement.
contents of a.txt: (In one line there is only 1, In second line there is only 2, as is) 1 2 3 4 5 ..so on till 47.
Output I want: As soon it reads 5. Output - "Step Completed is 5" (without double quotes) . This should go for 5,10,15,20 till 45
Here is the code but it doesn't seem to work.
#!/bin/bash while IFS= read -r line; do if [[ $line=="5" ]] ; then echo "Step Completed is:" $var fi done < "$1"
Also I want to echo the same statement for every 5 integer values i.e as soon as the script reads 5, it should echo - Step completed is 5. As soon as it reads 10, it should echo - Step Completed is 10. Like this.
To run the script I am using the command:
. ./al.sh a.txt