Look into this and suggest if any changes needed


 
Thread Tools Search this Thread
Operating Systems AIX Look into this and suggest if any changes needed
# 1  
Old 07-03-2006
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
# 2  
Old 07-03-2006
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:
https://www.unix.com/showthread.php?t=28659
Have you read/tested them? I'm afraid you have not...

Regards.
Login or Register to Ask a Question

Previous Thread | Next Thread

9 More Discussions You Might Find Interesting

1. Post Here to Contact Site Administrators and Moderators

Can you suggest a better forum to post?

Hello! I posted twice on issues I'm having getting the latest GCC compiler to compile ( "Command failed for target 'check-recursive' error" in the Solaris forum and "Compiling GCC 6.3.0 - Error with Library" in the UNIX for Beginners... forum) with zero responses. After many hours of beating my... (0 Replies)
Discussion started by: PJ_Namias
0 Replies

2. UNIX for Dummies Questions & Answers

Suggest books

Hi, I'm a beginner and am learning c programming. I want to learn UNIX/LINUX in parallel. But I don't know difference between UNIX and LINUX and where they are applied in real life. As a beginner, some people asked me to start with UNIX. Please let me know some very good books for UNIX. Also a... (6 Replies)
Discussion started by: nerdbee
6 Replies

3. Shell Programming and Scripting

Any body suggest me.........!!!!

i am jaswanth, i am very new to unix/linux, upto now i worked in windows only., but i took coatching for unix.., and my sir teached all my classes in red hat linux and told me that all are same...!!! I know shall programming in red hat linux.., but now i installed opensloaris but the... (5 Replies)
Discussion started by: strgraphics
5 Replies

4. Shell Programming and Scripting

please suggest me a site

hi i need to get the values from an xml file like the <TAG> values and write to a file please suggest me the commands and some good reading material sites so that i can implement (1 Reply)
Discussion started by: perlamohan
1 Replies

5. Shell Programming and Scripting

Can yum be used. If not please suggest.

Hi! I need to install a application from one server to several other servers. My script would copy the install-script to other machines and run it.Since it has to be non-interactive , just wondering if yum can be used for the same. Please let me know , if you guys are aware of other... (1 Reply)
Discussion started by: nua7
1 Replies

6. Shell Programming and Scripting

Please suggest some changes in my code

Hi All, I have made the following code which is taking 10-15 mins to execute completely. Here the file am using is very big( around 1050993843). Can any one make some changes in my code which reduces the time it takes to execute as am very much new to Unix(learner). One more thing, i have... (10 Replies)
Discussion started by: madhavsunduru
10 Replies

7. UNIX for Advanced & Expert Users

suggest book

Hi I am new to Unix/Linux I know commands and shell scripts which are useful for my project. But i need to know the basics and commands and shell scripts in detail and easy guide. Please refer a book. Thanks Haripatn (6 Replies)
Discussion started by: haripatn
6 Replies

8. Linux

suggest some ideas for reuse

hi can you all help me to develop anything in unix that could be reused. any module or application could be helpful (0 Replies)
Discussion started by: infyanurag
0 Replies

9. Shell Programming and Scripting

Can you suggest a more efficient way for this?

Hi I have the following at the end of a service shutdown script used in part of an active-passive failover setup: ### # Shutdown all primary Network Interfaces # associated with failover ### # get interface names based on IP's # and shut them down to simulate loss of # heartbeatd ... (1 Reply)
Discussion started by: mikie
1 Replies
Login or Register to Ask a Question