12-01-2017
Good morning,
Thanks for the response Scrutinizer. The line formatting was a good idea as it gave me something to go on with the other jobs like PEND and EXIT since they format a bit differently. I can now actually arrange the total output into something formatted better than the default.
I ended up using ypcat rather than getent since getent won't return user ID's that are all numeric. After some tinkering, getent proved to only return ID's that have at least one alpha character in them.
10 More Discussions You Might Find Interesting
1. UNIX for Dummies Questions & Answers
Hi,
I am triying to make sure that there exists only one file with the pattern abc* in path /path/. This directory is having many huge files. If there is only one file then I have to take its complete name only to use furter in my script.
I am planning to do like this:
if ; then... (2 Replies)
Discussion started by: new_learner
2 Replies
2. UNIX for Dummies Questions & Answers
Hi folks,
Please advise which command/command line shall I run;
1) to display the command and its output on console
2) simultaneous to save the command and its output on a file
I tried tee command as follows;
$ ps aux | grep mysql | tee /path/to/output.txt
It displayed the... (7 Replies)
Discussion started by: satimis
7 Replies
3. UNIX for Advanced & Expert Users
Is there a way to repeat the output of the last command for filtering without running the command again? All I could think of was to copy all the data to a text file and process it that way, is there another way? Like say I want to grep server.server.lan from a dtrace that was pages long after I... (5 Replies)
Discussion started by: glev2005
5 Replies
4. UNIX for Dummies Questions & Answers
Hey, guys!
Trying to research this is such a pain since the read command itself is a common word. Try searching "unix OR linux read command examples" or using the command substitution keyword. :eek:
So, I wanted to use a command statement similar to the following.
This is kinda taken... (2 Replies)
Discussion started by: ProGrammar
2 Replies
5. UNIX for Dummies Questions & Answers
HI Guys,
I hope you are well. I am trying to write a script that gets executed every time i open a shell (cshell). I have two questions about that
1) I need to enter these commands
$ echo $DISPLAY
$ setenv $DISPLAY output_of_echo_$display_command
How can i write a... (2 Replies)
Discussion started by: kaaliakahn
2 Replies
6. Shell Programming and Scripting
Hi Experts,
I am very much new to linux scripting, I am currently working on reducing my manual work and hence writing a script to automate few task.
I am running below command to snmpwalk the router..
snmpwalk -v 3 -u WANDL_SU -a MD5 -A vfipmpls -x DES -X VfIpMpLs -l authPriv... (19 Replies)
Discussion started by: Hanumant.madane
19 Replies
7. Red Hat
I ran the following command.
cat abc.c > abc.c
I got message the following message from command cat:
cat: abc.c : input file is same as the output file
How the command came to know of the destination file name as the command is sending output to standard file. (3 Replies)
Discussion started by: ravisingh
3 Replies
8. UNIX for Dummies Questions & Answers
Hi Guys,
I like to output every command executed in the script to a file.
I have tried set -x which does the same.
But it is not giving the logs of the child script which is being called from my script.
Is there any parameters in the Set command or someother way where i can see the log... (2 Replies)
Discussion started by: mac4rfree
2 Replies
9. Shell Programming and Scripting
I am using UNIX to create a script on our system. I have setup my commands to append their output to an outage file. However, some of the commands return no output and so I would like something to take their place.
What I need
The following command is placed at the prompt:
TICLI... (4 Replies)
Discussion started by: jbrass
4 Replies
10. Shell Programming and Scripting
Hello :)
new to bash not to programming.
I have an on-going need to change the owning group on sets of files and directories from the one they were created with or changed to on update to the one they need to have going forward.
find {target_root} -group wrong_group
gets me a newline... (4 Replies)
Discussion started by: naftali
4 Replies
LEARN ABOUT OPENSOLARIS
getent
getent(1M) System Administration Commands getent(1M)
NAME
getent - get entries from administrative database
SYNOPSIS
getent database [key]...
DESCRIPTION
getent gets a list of entries from the administrative database specified by database. The information generally comes from one or more of
the sources that are specified for the database in /etc/nsswitch.conf.
database is the name of the database to be examined. This can be passwd, group, hosts, ipnodes, services, protocols, ethers, project, net-
works, or netmasks. For each of these databases, getent uses the appropriate library routines described in getpwnam(3C), getgrnam(3C),
gethostbyaddr(3NSL), gethostbyname(3NSL), getipnodebyaddr(3SOCKET), getipnodebyname(3SOCKET), getservbyname(3SOCKET), getprotoby-
name(3SOCKET), ethers(3SOCKET), getprojbyname(3PROJECT) and getnetbyname(3SOCKET), respectively.
Each key must be in a format appropriate for searching on the respective database. For example, it can be a username or numeric-uid for
passwd; hostname or IP address for hosts; or service, service/protocol, port, or port/proto for services.
getent prints out the database entries that match each of the supplied keys, one per line, in the format of the matching administrative
file: passwd(4), group(4), project(4), hosts(4), services(4), protocols(4), ethers(3SOCKET), networks(4), or netmasks(4). If no key is
given, all entries returned by the corresponding enumeration library routine, for example, getpwent() or gethostent(), are printed. Enumer-
ation is not supported on ipnodes.
Key Interpretation for passwd and group Databases
When getent is invoked with database set to passwd, each key value is processed as follows:
o If the key value consists only of numeric characters, getent assumes that the key value is a numeric user ID and searches the
user database for a matching user ID.
o If the user ID is not found in the user database or if the key value contains any non-numeric characters, getent assumes the key
value is a user name and searches the user database for a matching user name.
Similarly, when getent is invoked with database set to group, each key value is processed as follows:
o If the key value consists only of numeric characters, getent assumes that the key value is a numeric group ID and searches the
group database for a matching group ID.
o If the group ID is not found in the group database or if the key value contains any non-numeric characters, getent assumes the
key value is a group name and searches the group database for a matching group name.
EXIT STATUS
The following exit values are returned:
0 Successful completion.
1 Command syntax was incorrect, an invalid option was used, or an internal error occurred.
2 At least one of the specified entry names was not found in the database.
3 There is no support for enumeration on this database.
FILES
/etc/nsswitch.conf name service switch configuration file
/etc/passwd password file
/etc/group group file
/etc/inet/hosts IPv4 and IPv6 host name database
/etc/services Internet services and aliases
/etc/project project file
/etc/protocols protocol name database
/etc/ethers Ethernet address to hostname database or domain
/etc/networks network name database
/etc/netmasks network mask database
ATTRIBUTES
See attributes(5) for descriptions of the following attributes:
+-----------------------------+-----------------------------+
| ATTRIBUTE TYPE | ATTRIBUTE VALUE |
+-----------------------------+-----------------------------+
|Availability |SUNWcsu |
+-----------------------------+-----------------------------+
SEE ALSO
ethers(3SOCKET), getgrnam(3C), gethostbyaddr(3NSL), gethostbyname(3NSL), gethostent(3NSL), getipnodebyaddr(3SOCKET), getipnodeby-
name(3SOCKET), getnetbyname(3SOCKET), getprojbyname(3PROJECT), getprotobyname(3SOCKET), getpwnam(3C), getservbyname(3SOCKET), group(4),
hosts(4), netmasks(4), networks(4), nsswitch.conf(4), passwd(4), project(4), protocols(4), services(4), attributes(5)
SunOS 5.11 26 Mar 2007 getent(1M)