Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function searchPerson {
- while IFS= read -r line
- do
- IFS="|" read -r -a arr <<< "$line"
- lineValid=true
- # check if $ime is empty, if it is, we are not using it to searching
- # [0]-id | [1]-ime | [2]-priimek | [3]-naslov | [4]-posta | [5]-tel
- if [ ! -z "$ime" ] && [ "${arr[1]}" != "$ime" ]; then
- lineValid=false
- fi
- if [ ! -z "$priimek" ] && [ "${arr[2]}" != "$priimek" ]; then
- lineValid=false
- fi
- if [ ! -z "$naslov" ] && [ "${arr[3]}" != "$naslov" ]; then
- lineValid=false
- fi
- if [ ! -z "$posta" ] && [ "${arr[4]}" != "$posta" ]; then
- lineValid=false
- fi
- if [ ! -z "$tel" ] && [ "${arr[5]}" != "$tel" ]; then
- lineValid=false
- fi
- if [ $lineValid = true ]; then
- echo $line
- fi
- done < imenik.dat
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement