The UNIX and Linux Forums  

Go Back   The UNIX and Linux Forums > Top Forums > Shell Programming and Scripting
.
google unix.com




Thread: Parsing a file
View Single Post in the UNIX and Linux Forums - Click on the Thread or Permalink to View Entire Thread -->
  #2 (permalink)  
Old 10-13-2008
treesloth treesloth is offline
Registered User
  
 

Join Date: Oct 2008
Location: Orem, Utah
Posts: 73
Pardon my ignorance, but what kind of system are you using? How is the /etc/default/security file structured? Let's suppose it's just a whitespace-separated table, such as:


Code:
VALUE1     <data>
VALUE2     <data>
...
...
MIN_PASSWORD_LENGTH     8
...
...
VALUEn     <data>

Then something like this might do the trick:


Code:
grep ^MIN_PASSWORD_LENGTH /etc/default/security | awk '{ if ($2 > 6) print "Value is good"; else print "Danger, Will Robinson!" }'

Alter values, messages, and possibly the awk field separator, as needed. Rinse and repeat. It might be that more information is needed to make this match the security file; just post any relevant information and I'm sure we can put something together.