Fileinhalt suchen

Aus Primatenwiki
Zur Navigation springen Zur Suche springen

find / -type f -name "*.txt" | xargs grep "was"


Files mit bestimmtem Inhalt verschieben

#!/bin/bash

# call this script with <script.sh> "<serachstring>" <searchdir> <movedir>

grep -lri "$1" $2 | while read -r line ; do
    echo "Processing $line"
    cp -p $line $3
done