~johanvandegriff/unix-shell-programming-revised-edition-programs

unix-shell-programming-revised-edition-programs/search -rw-r--r-- 253 bytes
fc214385Johan Vandegriff added other old scripts, some newer ones too 1 year, 8 months ago
                                                                                
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
#!/bin/bash
tmp="$HOME/tmp$RANDOM"
if [ "$2" == "-v" ]
then
  find "$1" | grep -v "$3" > "$tmp"
  shift 2
else
  find "$1" > "$tmp"
fi
while read file
do
  if grep "$2" "$file" 2> /dev/null
  then
    echo "$file"
    echo
  fi
done < "$tmp"

rm "$tmp"