Welcome, guest | Sign In | My Account | Store | Cart
#!/usr/bin/env zsh

tmp_file
="/tmp/_unsorted_find_n_grep"
echo
"--- find <$2> in <$1>" > $tmp_file

find
. -follow -iname "$1" | while read file
do
        timestamp
=$(ls -l --time-style=+"%Y-%m-%d %H:%M:%S" "$file" | gawk '{print $6, $7}')
        linestack
=${(@f)$(egrep "$2" "$file")}
       
for line in $linestack
       
do
                echo
"$timestamp $file: $line" >> $tmp_file
       
done
done

cat $tmp_file
| sort
rm $tmp_file

Diff to Previous Revision

--- revision 1 2013-09-17 08:45:18
+++ revision 2 2013-09-17 08:48:07
@@ -9,7 +9,7 @@
        linestack
=${(@f)$(egrep "$2" "$file")}
       
for line in $linestack
       
do
-               echo "$timestamp $file: $line" >> /tmp/chassagne_find
+               echo "$timestamp $file: $line" >> $tmp_file
       
done
 
done
 

History