Created
April 1, 2016 03:09
-
-
Save quickgrid/0ec0c1881b3914164ae72c36fb310b60 to your computer and use it in GitHub Desktop.
Reads the input file line by line in while loop then checks if the number is even or odd using if condition and finally prints even lines.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
i=1 | |
while read line | |
do | |
var=$(( $i % 2 )) | |
if [ $var -eq 0 ]; then | |
echo "$line" | |
fi | |
i=$(( $i + 1 )) | |
done < "FaxNumbers.txt" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment