Creating an entry for /etc/passwd


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Creating an entry for /etc/passwd
# 8  
Old 09-12-2003
They are only valid within awk. You can capture awk's output to a variable or file if you want.

e.g.

user=`awk -F, '{print tolower(substr($1,0,1)) tolower(substr($1,match($1," ")+1,7))}' file1`

or

awk -F, '{print tolower(substr($1,0,1)) tolower(substr($1,match($1," ")+1,7))}' file1 > userfile

But you can't access the variables as $1 or $2 outside awk.

Does that answer your question ?

Matt.
# 9  
Old 09-13-2003
Yes.. I tried directed the output to another file to..

thanks
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. UNIX for Advanced & Expert Users

Big problem: shell entry in /etc/passwd corrupted for user root

did a big mistake, changing root entry of /etc/passwd to root:x:0:0:root:/root:/usr/bin/tmux split-window -v \; attach as expected, now I can't login as root anymore. sudo ed /etc/passwd etc. doesn't work. Any idea? Use code tags to increase readability and follow the rules. (4 Replies)
Discussion started by: dodona
4 Replies

2. HP-UX

Sudo entry required to set permission similar to ROOT without using password (PASSWD) change optio

Hi All I had installed sudo in HP UX 11.3 and it is working fine but not able to make entry required to set permission similar to ROOT without using password (PASSWD) change option for define user in /etc/sudoers file Please help if some know the syntex? :confused::wall: (2 Replies)
Discussion started by: deviltech
2 Replies

3. AIX

When did AIX start using /etc/security/passwd instead of /etc/passwd to store encrypted passwords?

Does anyone know when AIX started using /etc/security/passwd instead of /etc/passwd to store encrypted passwords? (1 Reply)
Discussion started by: Anne Neville
1 Replies

4. Solaris

passwd cmd reenables passwd aging in shadow entry

Hi Folks, I have Solaris 10, latest release. We have passwd aging set in /etc/defalut/passwd. I have an account that passwd should never expire. Acheived by emptying associated users shadow file entries for passwd aging. When I reset the users passwd using passwd command, it re enables... (3 Replies)
Discussion started by: BG_JrAdmin
3 Replies

5. UNIX for Advanced & Expert Users

No entry in /etc/passwd

I could not find an entry for my linux user account in /etc/passwd file. I can remember some time back one of my SA showed the entry line using some other command. Can someone please help me on this to view the details of my linux user account? (3 Replies)
Discussion started by: apsprabhu
3 Replies

6. Linux

Cron ORPHAN (no passwd entry)

I am using the standard vixie-cron am seeing the following my logs : crond: (username) ORPHAN (no passwd entry) Ordinarily this is a simple matter, there is no corresponding user, but I am using central authentication and the username does exist and is usable via the standard nsswitch mechanism, so... (2 Replies)
Discussion started by: humbletech99
2 Replies

7. UNIX for Dummies Questions & Answers

Creating a copy of the /etc/passwd file

Is there a command for creating a copy of the /etc/passwd file named "./copy-passwd" that contains only the entries for userids that have a home directory in /home/inst, and change each entry in your copy so that the default login shell is /bin/sh. (2 Replies)
Discussion started by: raidkridley
2 Replies

8. Programming

Whant to write an entry in /etc/passwd (putpwent)

Hi i try to use the function putpwent to write a simple entry in "/etc/passwd" putpwnet returns 0 as it works but notething writes to /etc/passwd. What have i missed? My os -------- root@nighter-laptop:/home/nighter/labb# uname -a Linux nighter-laptop 2.6.22-14-generic #1 SMP Sun Oct 14... (5 Replies)
Discussion started by: nighter
5 Replies

9. UNIX for Dummies Questions & Answers

Clarification on /etc/passwd file entry

Hi, I am working on a UNIX AIX system and all the entries in /etc/passwd file are in the following format.. root:!:0:0::/:/usr/bin/ksh I have an idea abt each field, but I am confused abt the values in the second field. If the value of the second filed is 'x' then it means the password... (2 Replies)
Discussion started by: quintet
2 Replies

10. Shell Programming and Scripting

Creating usrname in /etc/passwd file

I want to create a usrname field for /etc/passwd file consisting of the first letter of the first name and the first 7 letters of the second name. I have got this so far --> awk -F, '{print tolower(substr($1,0,1)) tolower(substr($1,match($1," ")+1,7))}' file1 > /tmp/data Where file1 contains... (3 Replies)
Discussion started by: sleepster
3 Replies
Login or Register to Ask a Question