Operating System - HP-UX
1748289 Members
3192 Online
108761 Solutions
New Discussion юеВ

Re: Strings the user group

 
SOLVED
Go to solution
Chui Kock You_1
Frequent Advisor

Strings the user group

Hi Guru,

Our problem is when more then 500 user in one group, we are unable to see the that group user.

for example

group sb , actually this group have more than 500 user inside . but when i edit the group (/etc , vi group) cannot to see the user name . error like below . so i think we need to strings the group . we have tried command : strings group group.string . but still same .

@
@
@
@
@
@
@
@
@
@
@
@
@
@
@
@

Any idea.

Regards,
Chui
10 REPLIES 10
Bill Hassell
Honored Contributor
Solution

Re: Strings the user group

This is normal for vi...your group file is fine. The first thing to do is to expaned your terminal emulator so it is more than 100 characters wide, perhaps 150. But the better way to fix the group file is to break up the IDs for the same group into multiple lines:

Before:
users::20:blh,abc,def,xyz,aaa,bbb,ccc...really long...

After:

users::20:blh,abc,def,xyz
users::20:aaa,bbb,ccc
users::20:dddd,ee,ffff,ggg
users::20:qwer,asdf,zxcv

and so on. You can repeat the same group ID as many times as you want.


Bill Hassell, sysadmin
Chui Kock You_1
Frequent Advisor

Re: Strings the user group

Hi Bill,

Do you the command line on how to break up the IDs for the same group?

Regards,
Chui
Jose Mosquera
Honored Contributor

Re: Strings the user group

Hi,

Try with attached script. Please check and customize three variables inside. From the placement where you run the script a new group.mod file will be created. Your original /etc/group file will be unchanged.

Rgds.
Jose Mosquera
Honored Contributor

Re: Strings the user group

Hi again,

Previous script have a bug, please try with this new one.

Rgds.
Hein van den Heuvel
Honored Contributor

Re: Strings the user group


Try this 'one liner':

perl -pe 'm /^(\w+::\d+:)/; $grp=$1; s/((,[^,]+){8})./$1\n$grp/g' < long > short

explanation:

-pe # loop over input and print after processing
m /^(\w+::\d+:)/; # match the group name and number
$grp=$1; # remember group name and number

s/((,[^,]+){7}),/$1\n$grp/g' # look for 7 groups of a comma followed by a series of non-commas, and followed by a comma
Replace those with a newline, the group and the itself.

hth,
Hein

notes...

To test this I used perl to generate some long lines:

$ perl -le 'print qq(aap::20:), join q(,),(1000..1070)' >> long

Personally I would probably use a some script, not a one-liner and add more control like SORTing the element.

while (<>) {
m /(\w+::\d+:)(.*)/;
$grp=$1;
@mem=sort split /,/,$2;
$tmp = $grp;
$m = 0;
for (@mem) {
print $tmp,$_;
$tmp = ( ++$m % 7) ? q(,) : qq(\n$grp);
}
print qq(\n);
}
Dennis Handly
Acclaimed Contributor

Re: Strings the user group

Have you tried vim to edit your file?
Chui Kock You_1
Frequent Advisor

Re: Strings the user group

Hi Dennis,

Do you the command line for vim?

Regards,
Chui
Chui Kock You_1
Frequent Advisor

Re: Strings the user group

Hi Dennis,

Sorry. Forgot to add a word? Do you have the command line for vim?

Regards,
Chui
Viktor Balogh
Honored Contributor

Re: Strings the user group

> Do you have the command line for vim?

vim is gnu tool which install under /usr/local

http://hpux.connect.org.uk/hppd/hpux/Editors/vim-7.3/

it is AFAIK also part of the Internet Express DVD
****
Unix operates with beer.