banging my head against the wall (despite what Craig Brooksby says, I am
not the smart one)
simple script...
#!/bin/sh
infile="/tmp/outfile.txt"
outfile="/tmp/default_user.php"
> $outfile
for i in `cat $infile`; \
do \
if ${i:6:5} = "START"
then printf $i >> $outfile
else
printf "if (!function_exists('_prefs_hook_$i')) { \n\n" >>
$outfile
fi
done
# head -n 4 /tmp/outfile.txt
**** START OF SECTION - horde - ****
default_identity
identities
identityselect
#### gives you the idea of what I'm working on...
What I am trying to do is see if line has "***** START ...
and if so, write it to the outfile
otherwise, write the other (else)
The else works fine but the IF evaluates as a local file and not the
value the 5 characters after the 6 offset and tries to execute it -
which of course generates a whole pile of standard error junk.
How do I do this in bash?
Craig
---------------------------------------------------
PLUG-discuss mailing list -
PLUG-discuss@lists.plug.phoenix.az.us
To subscribe, unsubscribe, or to change you mail settings:
http://lists.PLUG.phoenix.az.us/mailman/listinfo/plug-discuss