FKLook - cerca keyword e copia i file
Ciao a tutti,
ecco il mio nuovo nato FKLook trattasi di uno script bash per Linux, che vi permette di cercare le keyword in una directory piena zeppa di file e copiare tutti quelli che la contengono in una directory di vostra scelta, in modo tale da avere un repository di file selezionati in base alla keyword.
Testatelo!
ciao
# /bin/bash/ # File Keywords searching tool by Nanni bassetti http://www.nannibassetti.com - nannib@libero.it echo "###################################################################" echo "FKLOOK - by Nanni Bassetti http://www.nannibassetti.com - nannib@libero.it" echo "by this script you can search for a keyword in many files" echo "and it copies only the files those match with the keyword, in a separated directory you chose" echo "###################################################################" echo " " echo "Write the output directory where you to save the files (eg. /media/myfiles):" read outdi data=$(date | sed 's/ //g' | sed 's/://g' | sed 's/[[:alpha:]]//g') mkdir $outdi$data outdir=$outdi$data echo "This is the directory for your repository: ".$outdir echo "Write directory contains the files where you want to looking for the keyword:" read indir echo "Write the keyword search:" read key grep -aR -i $key $indir/*.* > $outdir/filelist.txt fn="$(cat $outdir/filelist.txt | awk -F ":" '{print $1}'|sed 's/*//')" cp $indir/$fn $outdir 2>/dev/null cd $outdir ls -l
|