
May 4th, 2011, 08:06 AM
|
 |
Learning MySQL, PHP & CSS
|
|
Join Date: Jun 2007
Location: Powys/Shrops border (UK)
|
|
|
Help with awk (I think!) SOLVED
Hi again. I have this code in my shell script but would like to get rid of the rather untidy "if" statement ... I _think_ 'awk' is what I need to be able to read from a plain text file which lists directories NOT to process. Basically doing "if $dirname is not in the text file, then ..." but I can't figure it out or find an example I could hack. Any suggestions are much appreciated.
Code:
cd /home
for dirname in `find -maxdepth 1 -mindepth 1 -type d | sort` ;
do
if [ $dirname != "./tech_transfer" -a $dirname != "./transfer" -a $dirname != "./lost+found" ] ; then
(rest of script...)
fi
done
SOLVED!
No worries, I found the solution was to use grep, not awk!
Code:
if ! grep -q $(basename $dirname) /usr/sbin/dirsize.txt ; then
__________________
It said 'Insert disk #2', but only one will fit.
Last edited by mikeatvillage : May 5th, 2011 at 05:16 AM.
Reason: SOLVED
|