Thursday 7 July 2016

How to read a file line by line using Linux shell scrpit

This the simple and easy code to read a file using linux script.

Here in the code we read all the lines and display each line :)

file="/home/system5/Desktop/negativewords/neagtivewords" #readng neg words
while IFS= read -r line
do
        # display $line or do somthing with $line
    printf '%s\n' "$line"

done <"$file"