- Community Home
- >
- Servers and Operating Systems
- >
- Legacy
- >
- HPE 9000 and HPE e3000 Servers
- >
- A help on script
Categories
Company
Local Language
Forums
Discussions
Forums
- Data Protection and Retention
- Entry Storage Systems
- Legacy
- Midrange and Enterprise Storage
- Storage Networking
- HPE Nimble Storage
Discussions
Discussions
Discussions
Forums
Forums
Discussions
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
- BladeSystem Infrastructure and Application Solutions
- Appliance Servers
- Alpha Servers
- BackOffice Products
- Internet Products
- HPE 9000 and HPE e3000 Servers
- Networking
- Netservers
- Secure OS Software for Linux
- Server Management (Insight Manager 7)
- Windows Server 2003
- Operating System - Tru64 Unix
- ProLiant Deployment and Provisioning
- Linux-Based Community / Regional
- Microsoft System Center Integration
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Community
Resources
Forums
Blogs
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО11-01-2006 09:28 PM
тАО11-01-2006 09:28 PM
For a user revalidation purpose , i need to get the details of users in certain format.
ie CUSID|USERID|COMMENT|Primary goup|enabled/disabled|last logon|
I have compiled a small script for that, but it is not working. The fist line ie cutting the first column of passwd file itself is not working. I am not able to explain why as when i look the syntax is correct.
Could any one help me here?
for i in `cat /etc/passwd`
do
USER=`$i|cut -f 1 -d ":"`
COMMENT=`$i | cut -f 5 -d ":"`
GROUP=`groups $user`
enable=`/usr/lbin/getprpw -l -r -m lockout $USER`
LAST=`last | grep $USER | head -1 | awk '{print $4 "\t" $5 "\t" $6}'`
URT="IN-TEST"
done
Thanks so
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО11-02-2006 01:01 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО11-02-2006 01:09 AM
тАО11-02-2006 01:09 AM
Re: A help on script
You might want to replace your 'for' loop with something like this:
exec # the following commands will read from
# /etc/passwd unless specified otherwise
while read i
do
USER=... # as before
# ...and so on...
done
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО11-02-2006 02:23 AM
тАО11-02-2006 02:23 AM
Re: A help on script
#!/usr/bin/ksh
while read i
do
USER=`echo $i|cut -f 1 -d ":"`
COMMENT=`echo $i | cut -f 5 -d ":"`
GROUP=`echo $i | cut -f 4 -d ":"`
enable=`/usr/lbin/getprpw -l -r -m lockout $USER`
LAST=`last -1 $USER | awk '{print $4 "\t" $5 "\t" $6}'`
URT="IN-TEST"
done < /etc/passwd
Yang
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО11-02-2006 08:20 PM
тАО11-02-2006 08:20 PM
Re: A help on script
I completed it with the help of both your comments.Thanks a lot.from my query itself it is understood that I am a biginer in scripting.I am not sure this forum is meant for addressing such queries, if i am wrong apologies.
Points have been assigned .
Thanks again
s.o