- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- Test Processing
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
Forums
Discussions
Discussions
Discussions
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
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
08-26-2008 12:02 PM
08-26-2008 12:02 PM
I want to make a single file taking users entries from 3 files combine into a single file. For users who exist in all the 3 servers, I want to list their 3 uids infront of their user names. Can some one give me some direction how to do that?
Solved! Go to Solution.
- Tags:
- passwd
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-26-2008 01:08 PM
08-26-2008 01:08 PM
Re: Test Processing
cat passwd | awk -F: '{print $1}'
Use this command to make lists.
diff the files and use sort -u to come up with a single, valid master user list.
Then combine the files. Probably best to cat them into one file and delete the dups.
SEP
Owner of ISN Corporation
http://isnamerica.com
http://hpuxconsulting.com
Sponsor: http://hpux.ws
Twitter: http://twitter.com/hpuxlinux
Founder http://newdatacloud.com
- Tags:
- awk
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-26-2008 09:00 PM
08-26-2008 09:00 PM
Re: Test Processing
U can use the below command for 3 passwd file. then take the output of each file into same xl sheet then sort it by name. After that u can make one file .But before doing any activity like replacing the file first take the backup of that file.
the command is
cat /etc/passwd | awk -F: '{print $1 ,$3}'
Best Luck
Atul
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-27-2008 01:33 AM
08-27-2008 01:33 AM
Re: Test Processing
awk -F: '{print $3, $1}' firstfile secfile thirdfile |sort -k2 > userlist
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-27-2008 05:31 AM
08-27-2008 05:31 AM
Re: Test Processing
Lets say I have a user called steve on three servers having different uids like 108, 120, 139 on three different servers but same username steve on all of them, and on the other hand, lets say I have another user kami on just one server having uid 159, I want my resulting file to look like that.
steve 108 120 130
kami 159
Can some one help me in this?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-27-2008 05:47 AM
08-27-2008 05:47 AM
Solution# cat .allusers
#!/usr/bin/perl
use strict;
use warnings;
my ( %users, $name, $uid );
while (<>) {
my ( $name, $uid ) = ( split /:/ )[ 0, 2 ];
push( @{ $users{$name} }, $uid );
}
for $name ( sort keys %users ) {
print "$name: @{$users{$name}}\n";
}
1;
...run, passing any number of files as arguments, like:
# ./allusers /etc/passwd /etc/passwd.server2 /etc/passwd.server3
...output looks like:
ablebody: 300
somebody: 333
wagar: 111 1221
zebra: 101 102 101
Regards!
...JRF...
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-27-2008 05:52 AM
08-27-2008 05:52 AM
Re: Test Processing
awk -F: '{print $1 " " $3}' passwd1|while read username uid
do
echo "File1: $uid $username"
echo "File2: \c"
awk -F: '$1 ~ "$username" {print $1 " " $3}' passwd2
echo "File3: \c"
awk -F: '$1 ~ "$username" {print $1 " " $3}' passwd3
done
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-28-2008 02:29 AM
08-28-2008 02:29 AM
Re: Test Processing
sort passwd1 passwd2 passwd3 | awk -F: '
BEGIN { getline; name = $1; uid = $3 }
{
if ($1 == name) {
uid = uid " " $3 # concat
} else {
print name, uid # print last
name = $1; uid = $3
}
}
END { print name, uid } '
- Tags:
- awk
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-28-2008 04:38 AM
08-28-2008 04:38 AM
Re: Test Processing
I need one more help, Lets say if I wanna add when that particular user logs in last time, how can I add that to this script.
Lets say if I have a user steve and he logged in for the last time one week before, output should be like that:
Steve uid1 uid2 uid3 19-AUG-08