Sponsored Content
Top Forums UNIX for Dummies Questions & Answers space delimited list of users in a variable Post 302424986 by holocene on Wednesday 26th of May 2010 11:59:17 PM
Old 05-27-2010
space delimited list of users in a variable

Greetings

So glad I found this forum!

I need to get a list of users in a variable so I can use "for" to iterate through them in a bash script.

I know this does not work, but I need to do something like this:

myusers=(cat /etc/passwd | cut -f1 -d )

for myuser in $myusers
do
some work on the user in $myuser
done

google failed to return an answer.

thanks in advance
Steve.
 

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

Converting Space delimited file to Tab delimited file

Hi all, I have a file with single white space delimited values, I want to convert them to a tab delimited file. I tried sed, tr ... but nothing is working. Thanks, Rajeevan D (16 Replies)
Discussion started by: jeevs81
16 Replies

2. UNIX for Dummies Questions & Answers

Three space delimited files

So I have three space delimited files. Each have 90 rows and many columns. I want to merge them by columns. I use paste to merge file 1 and file2 or file 3 and it works. But when I try to merge file 2 and file 3 using paste or merge or cat, I cannot merge them by column, instead they are merged by... (11 Replies)
Discussion started by: evelibertine
11 Replies

3. Shell Programming and Scripting

How to convert a space delimited file into a pipe delimited file using shellscript?

Hi All, I have space delimited file similar to the one as shown below.. I need to convert it as a pipe delimited, the values inside the pipe delimited file should be as highlighted... AA ATIU2345098809 009697 005374 BB ATIU2345097809 005445 006518 CC ATIU9685098809 003215 003571 DD... (7 Replies)
Discussion started by: nithins007
7 Replies

4. UNIX for Dummies Questions & Answers

Changing only the first space to a tab in a space delimited text file

Hi, I have a space delimited text file but I only want to change the first space to a tab and keep the rest of the spaces intact. How do I go about doing that? Thanks! (3 Replies)
Discussion started by: evelibertine
3 Replies

5. UNIX for Dummies Questions & Answers

Transposing a huge space delimited file

Hi, How do I transpose a huge space delimited file with more than 2 million columns and about 100 rows? Thanks! (10 Replies)
Discussion started by: evelibertine
10 Replies

6. Shell Programming and Scripting

How to make tab delimited file to space delimited?

Hi How to make tab delimited file to space delimited? in put file: ABC kgy jkh ghj ash kjl o/p file: ABC kgy jkh ghj ash kjl Use code tags, thanks. (1 Reply)
Discussion started by: jagdishrout
1 Replies

7. UNIX for Dummies Questions & Answers

List of All Users Stored in Variable

I'm trying to get a list of all users on the system, store the list in a variable, then find all the files of a certain extension owned by each of the users. The command I use to get the list is getent passwd | cut -d: -f1 | sortand this works just fine. However, if I try to store it in a... (1 Reply)
Discussion started by: hobscrk777
1 Replies

8. Shell Programming and Scripting

Remove space before numbers in delimited file

Hi, I have a file which looks like this FORD|1333-1| 10000100010203| 100040507697|0002|356.45|5555| SSSSY|KKKKM|1000005|10| N096|10043| C987 I need the output to look like this FORD|1333-1|10000100010203|100040507697|0002|356.45|5555| SSSSY|KKKKM|1000005|10| N096|10043| C987 The leading... (8 Replies)
Discussion started by: wahi80
8 Replies

9. Shell Programming and Scripting

Help/Advise please for converting space delimited string variable to comma delimited with quote

Hi, I am wanting to create a script that will construct a SQL statement based on a a space delimited string that it read from a config file. Example of the SQL will be For example, it will read a string like "AAA BBB CCC" and assign to a variable named IN_STRING. I then concatenate... (2 Replies)
Discussion started by: newbie_01
2 Replies

10. Homework & Coursework Questions

Space delimited variables

I have a shell script where I am using space delimited variables. Var=" ${var} data1 table1 " Var=" ${var} data2 table2 " Var=" ${var} data3 table3 " Var=" ${var} data4 table4 " I am using a single variable to store multiple values so I can use them in for loop. Each value contains space in... (1 Reply)
Discussion started by: srilaxman
1 Replies
removeuser(8)						      System Manager's Manual						     removeuser(8)

NAME
removeuser - Deletes user accounts interactively SYNOPSIS
/usr/sbin/removeuser DESCRIPTION
Security Note If you have enhanced security installed on your system, you should use the dxaccounts command to remove users. See the Security manual and the dxaccounts(8) reference page for more information. The removeuser command is an interactive command for deleting user accounts from your system. It also gives the option of deleting the user's home directory, files and mail. The command prompts you for specific information and informs you of its activity and error condi- tions. The removeuser command invokes /usr/sbin/userdel to delete the user account information from /etc/passwd and the hashed password database (if present). Only the superuser can execute this command. The command performs the following tasks: Asks for a login name for the user to be deleted. Enter the login name. If this entry does not exist in the /etc/passwd file, the command informs you of this and exits. If the entry does exist, the command continues. Displays the entry for the user from the /etc/passwd file and asks if this is the entry you want to delete. If the answer to this query is no, the com- mand indicates that the user was not deleted and then exits. If the answer to this query is yes, the command deletes the user's entry from the /etc/passwd file and any occurrences of the user from the /etc/group file. It then states that the user was deleted. Searches several administrative directories and files for occurrences of the user and informs you if they exist. If so, it suggests that you may want to delete these occurrences when the command is finished. If no occurrences of the user are found in these directories and files, the command indicates so. Asks if you want to delete the home directory, all subdirectories, and all mail files for the user. If the answer to this query is no, the command indicates that the user's home directory was not deleted and then exits. If the answer to this query is yes, the command continues. As a precaution, the command reminds you that you should have backed up the files for the user before removing them if you do not want to lose them. It then asks if you are sure that you want to delete the files for this user. If the answer to this query is no, the command indicates that the user's home directory was not deleted and then exits. If the answer to this query is yes, the command states that it is removing the user's home directory, its contents and the user's mail file. It then deletes these items. At this point, the command ends. NOTES
Users are advised to migrate to the /usr/sbin/userdel utility or the dxaccounts utility as this command may be removed in a future version of the operating system. EXAMPLES
Enter a login name to be removed or <Return> to exit: john This is the entry for (john) in the /etc/passwd file: john:VSh6/xbMqPDcY:5006:15:sdf:/usr/users/john: Is this the entry you want to delete (y/n)? y Working ... Entry for (john) removed. Searching relevant directories and files for (john) ... None found. Do you want to remove the home directory, all subdirectories, files, and mail for (john) (y/n)? y The files for (john) will be lost if not backed up. Are you sure you want to remove these files (y/n)? y Deleting /usr/users/john Deleting /usr/spool/mail/john FILES
Specifies the command path Group file Password file SEE ALSO
Commands: addgroup(8), adduser(8), dxaccounts(8), finger(1), mkpasswd(8), passwd(1), useradd(8), userdel(8), vipw(8) Files: group(4), passwd(4) removeuser(8)
All times are GMT -4. The time now is 05:34 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy