Sponsored Content
Top Forums UNIX for Dummies Questions & Answers Find EXACT word in files, just the word: no prefix, no suffix, no 'similar', just the word Post 302613859 by Freddythunder on Wednesday 28th of March 2012 02:26:57 AM
Old 03-28-2012
I am totally brand new to this so don't get mad if I'm wrong... But when I'm looking through the maillog for my name in a line, I do this:
# more maillog | grep "freddy"
which is what I think you're doing now. Have you tried putting the white space in the serach like " freddy "? I know that if you want to match spaces on either side you can use escaped s "\s" but have no example.
This User Gave Thanks to Freddythunder For This Post:
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Can a shell script pull the first word (or nth word) off each line of a text file?

Greetings. I am struggling with a shell script to make my life simpler, with a number of practical ways in which it could be used. I want to take a standard text file, and pull the 'n'th word from each line such as the first word from a text file. I'm struggling to see how each line can be... (5 Replies)
Discussion started by: tricky
5 Replies

2. Shell Programming and Scripting

find a word in a file, and change a word beneath it ??

Hi all, I have a file with lines written somewhat like this. aaaa ccc aa linux browse = no xssxw cdcedc dcsdcd csdw police dwed dwd browse = no cdecec (2 Replies)
Discussion started by: vikas027
2 Replies

3. Shell Programming and Scripting

Find Exact word in file

Hi ALL, I want to search one string “20 “ i.e 20 with space. But my file where I am searching this “20 “ contain some data like 120 before image file truncated 220 Reports section succeeded 20 Transaction database .prd stopped 220 Reports section completed. When I search for the... (5 Replies)
Discussion started by: Jeevan Salunke
5 Replies

4. UNIX for Dummies Questions & Answers

Script to search for a particular word in files and print the word and path name

Hi, i am new to unix shell scripting and i need a script which would search for a particular word in all the files present in a directory. The output should have the word and file path name. For example: "word" "path name". Thanks for the reply in adv,:) (3 Replies)
Discussion started by: virtual_45
3 Replies

5. Shell Programming and Scripting

Find and replace a word in all the files (that contain the word) under a directory

Hi Everyone, I am looking for a simple way for replacing all the files under a directory that use the server "xsgd1234dap" with "xsdr3423pap". For Example: In the Directory, $pwd /home/nick $ grep -l "xsgd1234dap" *.sh | wc -l 119 I have "119" files that are still using... (5 Replies)
Discussion started by: filter
5 Replies

6. Shell Programming and Scripting

Compare two files word by word

I need to compare two files word by word using unix shell scripting. Could someone help me? I need the code which will compare the 1st word from file1 with 1st word from file2, 2nd word from file1 with 2nd word from file2 etc..., for all the lines. Example: File1: aaa bbb ccc ... (7 Replies)
Discussion started by: rsmohankumar
7 Replies

7. Shell Programming and Scripting

perl lwp find word and print next word :)

hi all, I'm new there, I'm just playing with perl and lwp and I just successfully created a script for log in to a web site with post. I have a response but I would like to have something like this: I have in my response lines like: <div class="sender">mimi020</div> <some html code.....>... (3 Replies)
Discussion started by: vogueestylee
3 Replies

8. Shell Programming and Scripting

Shell Script @ Find a key word and If the key word matches then replace next 7 lines only

Hi All, I have a XML file which is looks like as below. <<please see the attachment >> <?xml version="1.0" encoding="UTF-8"?> <esites> <esite> <name>XXX.com</name> <storeId>10001</storeId> <module> ... (4 Replies)
Discussion started by: Rajeev_hbk
4 Replies

9. Shell Programming and Scripting

Find word in a line and output in which line the word occurs / no. of times it occurred

I have a file: file.txt, which contains the following data in it. This is a file, my name is Karl, what is this process, karl is karl junior, file is a test file, file's name is file.txt My name is not Karl, my name is Karl Joey What is your name? Do you know your name and... (3 Replies)
Discussion started by: anuragpgtgerman
3 Replies

10. Shell Programming and Scripting

Find a word and increment the number in the word & save into new files

Hi All, I am looking for a perl/awk/sed command to auto-increment the numbers line in file, P1.tcl: run_build_model sparc_ifu_dec run_drc set_faults -model path_delay -atpg_effectiveness -fault_coverage add_delay_paths P1 set_atpg -abort_limit 1000 run_atpg -ndetects 1000 I would like... (6 Replies)
Discussion started by: jypark22
6 Replies
nisinit(1M)						  System Administration Commands					       nisinit(1M)

NAME
nisinit - NIS+ client and server initialization utility SYNOPSIS
nisinit -r nisinit -p Y | D | N parent_domain host... nisinit -c [-k <key_domain>] -H host | -B | -C coldstart DESCRIPTION
nisinit initializes a machine to be a NIS+ client or an NIS+ root master server. It may be easier to use nisclient(1M) or nisserver(1M) to accomplish this same task. OPTIONS
-r Initialize the machine to be a NIS+ root server. This option creates the file /var/nis/data/root.object and initialize it to contain information about this machine. It uses the sysinfo(2) system call to retrieve the name of the default domain. To initialize the machine as an NIS+ root server, it is advisable to use the "-r" option of nisserver(1M), instead of using "nisinit -r". -p Y | D | N parent_domain host ... This option is used on a root server to initialize a /var/nis/data/parent.object to make this domain a part of the namespace above it. Only root servers can have parent objects. A parent object describes the namespace ``above'' the NIS+ root. If this is an isolated domain, this option should not be used. The argument to this option tells the command what type of name server is serving the domain above the NIS+ domain. When clients attempt to resolve a name that is outside of the NIS+ namespace, this object is returned with the error NIS_FOREIGNNS indicating that a name space boundary has been reached. It is up to the client to continue the name resolution process. The parameter parent_domain is the name of the parent domain in a syntax that is native to that type of domain. The list of host names that follow the domain parameter are the names of hosts that serve the parent domain. If there is more than one server for a parent domain, the first host specified should be the master server for that domain. Y Specifies that the parent directory is a NIS version 2 domain. D Specifies that the parent directory is a DNS domain. N Specifies that the parent directory is another NIS+ domain. This option is useful for connecting a pre-existing NIS+ subtree into the global namespace. Note that in the current implementation, the NIS+ clients do not take advantage of the -p feature. Also, since the parent object is currently not replicated on root replica servers, it is recommended that this option not be used. -c Initializes the machine to be a NIS+ client. There are three initialization options available: initialize by coldstart, initialize by hostname, and initialize by broadcast. The most secure mechanism is to initialize from a trusted coldstart file. The second option is to initialize using a hostname that you specify as a trusted host. The third method is to initialize by broadcast and it is the least secure method. -C coldstart Causes the file coldstart to be used as a prototype coldstart file when initializing a NIS+ client. This coldstart file can be copied from a machine that is already a client of the NIS+ namespace. For maximum security, an administrator can encrypt and encode (with uuencode(1C)) the coldstart file and mail it to an administrator bringing up a new machine. The new administrator would then decode (with uudecode), decrypt, and then use this file with the nisinit command to initialize the machine as an NIS+ client. If the coldstart file is from another client in the same domain, the nisinit command may be safely skipped and the file copied into the /var/nis directory as /var/nis/NIS_COLD_START. -H hostname Specifies that the host hostname should be contacted as a trusted NIS+ server. The nisinit command will iterate over each transport in the NETPATH environment variable and attempt to contact rpcbind(1M) on that machine. This hostname must be reachable from the client without the name service running. For IP networks this means that there must be an entry in /etc/hosts for this host when nisinit is invoked. -B Specifies that the nisinit command should use an IP broadcast to locate a NIS+ server on the local subnet. Any machine that is running the NIS+ service may answer. No guarantees are made that the server that answers is a server of the organization's namespace. If this option is used, it is advisable to check with your system administrator that the server and domain served are valid. The binding information can be dumped to the standard output using the nisshow- cache(1M) command. Note that nisinit -c will just enable navigation of the NIS+ name space from this client. To make NIS+ your name service, modify the file /etc/nsswitch.conf to reflect that. See nsswitch.conf(4) for more details. -k <key_domain> This option specifies the domain where root's credentials are stored. If it is not specified, then the system default domain is assumed. This domain name is used to create the /var/nis/NIS_COLD_START file. RETURN VALUES
nisinit returns 0 on success and 1 on failure. EXAMPLES
Example 1 Initializing the Machine as an NIS+ Client using the Host freddy as a Trusted Server This example initializes the machine as an NIS+ client using the host freddy as a trusted server. example# nisinit -cH freddy Example 2 Setting up a Client using a Trusted Coldstart File This example sets up a client using a trusted coldstart file. example# nisinit -cC /tmp/colddata Example 3 Setting up a Client Using an IP Broadcast This example sets up a client using an IP broadcast. example# nisinit -cB Example 4 Setting up a Root Server This example sets up a root server. example# nisinit -r ENVIRONMENT VARIABLES
NETPATH This environment variable may be set to the transports to try when contacting the NIS+ server (see netconfig(4)). The client library will only attempt to contact the server using connection oriented transports. FILES
/var/nis/NIS_COLD_START This file contains a list of servers, their transport addresses, and their Secure RPC public keys that serve the machine's default domain. /var/nis/data/root.object This file describes the root object of the NIS+ namespace. It is a standard XDR-encoded NIS+ directory object that can be modified by authorized clients using the nis_modify() interface. /var/nis/data/parent.object This file describes the namespace that is logically above the NIS+ namespace. The most common type of parent object is a DNS object. This object contains contact information for a server of that domain. /etc/hosts Internet host table. ATTRIBUTES
See attributes(5) for descriptions of the following attributes: +-----------------------------+-----------------------------+ | ATTRIBUTE TYPE | ATTRIBUTE VALUE | +-----------------------------+-----------------------------+ |Availability |SUNWnisu | +-----------------------------+-----------------------------+ SEE ALSO
NIS+(1), uuencode(1C), nisclient(1M), nisserver(1M), nisshowcache(1M), sysinfo(2), hosts(4), netconfig(4), nisfiles(4), attributes(5) NOTES
NIS+ might not be supported in future releases of the Solaris operating system. Tools to aid the migration from NIS+ to LDAP are available in the current Solaris release. For more information, visit http://www.sun.com/directory/nisplus/transition.html. SunOS 5.11 12 Dec 2001 nisinit(1M)
All times are GMT -4. The time now is 02:10 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy