The UNIX and Linux Forums  

Go Back   The UNIX and Linux Forums > OS Specific Forums > AIX
Google UNIX.COM


AIX AIX is IBM's industry-leading UNIX operating system that meets the demands of applications that businesses rely upon in today's marketplace.

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
suggest book haripatn UNIX for Advanced & Expert Users 6 05-02-2008 02:14 PM
Can you suggest a more efficient way for this? mikie Shell Programming and Scripting 1 11-20-2006 06:49 AM
Two SQL connections..suggest changes. bhagat.singh-j Shell Programming and Scripting 0 10-24-2006 11:21 PM
Suggest me the easiest method shihabvk UNIX for Advanced & Expert Users 1 08-11-2006 03:40 AM

Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 07-03-2006
Registered User
 

Join Date: Apr 2006
Posts: 18
Look into this and suggest if any changes needed

Hi,
I am new script programming, I have written a script shown velow to read username and passwd from /etc/security/passwd, i am able to read username, but unable to grep lastupdate. please look into the code and suggest if any changes need.

#!/bin/ksh

USERNAME=""
fname=/usr/bin/lastupdate
ftemp=./temp

cat /etc/security/passwd | \
while read LINE
do
echo "$LINE" > fstring
USERWORDCNT=`grep ":" fstring | wc -w`
if [ $USERWORDCNT = 1 ]
then
USERNAME=$LINE
fi
UPDATEWORDCNT=`grep "lastupdate" fstring | wc -w`
if [ $UPDATEWORDCNT = 1 ]
then
UPDATE=`cat fstring | cut -d= -f2`
echo "$UPDATE"
STRING=$USERNAME$UPDATE
echo $STRING >> $fname
USERNAME=""
UPDATE=""
fi
done
chmod 666 $fname


Note: The output of programme should write username and lastupdate values ony to another new file in this format as shown below:

smith:12445
grith:34455
Reply With Quote
Forum Sponsor
  #2 (permalink)  
Old 07-03-2006
grial's Avatar
El UNIX es como un toro
 

Join Date: Jun 2006
Location: Madrid (Spain)
Posts: 531
Helo.
You've been asking the same thing repeatedly. Have a look at the forum rules (#4).
Besides, I gave you some tips for what you are asking:
how to read password information on the AIX
Have you read/tested them? I'm afraid you have not...

Regards.
Reply With Quote
Google UNIX.COM
Reply

Thread Tools
Display Modes




All times are GMT -7. The time now is 11:19 PM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited.
The UNIX and Linux Forums Content Copyright ©1993-2008 The CEP Blog All Rights Reserved -Ad Management by RedTyger Visit The Global Fact Book

Content Relevant URLs by vBSEO 3.2.0