Quote:
Originally Posted by prowla
So close...
Code:
SIZE=`grep sizelimit myfile | sed 's/^.*sizelimit //' | awk '{print $1}'`
should work (NB. It allows for the arguments to be in a different order in the file).
There are other options that involve parsing the line (either in awk or shell), like:
Code:
SIZE=0
grep sizelimit myfile | while read s
do
set -- $s
while [ $# -gt 0 ]
do
case $1 in
-sizelimit) SIZE=$2; break;;
*) shift;;
esac
done
done
|
Thanks a lot prowla!
The first option works fine. Did you mean it works even if "-sizelimit 80000000" is moved somewhere else in the line too?