Sponsored Content
Full Discussion: How to search file content
Operating Systems Linux How to search file content Post 302218744 by satimis on Saturday 26th of July 2008 08:58:16 AM
Old 07-26-2008
How to search file content

Hi folks,


What will be an easy and effective way searching file content? E.G I need to find a WORD or a PHRASE on a file? TIA


B.R.
satimis
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

shell script to search content of file with timestamps in the directory

hello, i want to make a script to search the file contents in my home directory by a given date and output me the line that has the date... (10 Replies)
Discussion started by: psychobeauty
10 Replies

2. UNIX for Advanced & Expert Users

Search files with specfic extention and later search content

Hi, I would appriciate if somebody can help me figure out how to search for all the *.xml file under a specific directory and subdirectroies (/home/username) and later search of content "<start>" inside the xml file returned by search. -Lovin.V (2 Replies)
Discussion started by: lovi_v
2 Replies

3. UNIX for Dummies Questions & Answers

Search File content.

Hi, I have a problem when searching a file, the file containt with the following: 95671660:Jones:Sarah:45:sales manager 93272658:Smith:John:43:technical manager 98781987:Williams:Nick:35:computer officer 99893878:Brown:Sarah:12:electrician 95673456:Couch:David:26:chef... (3 Replies)
Discussion started by: elenatec
3 Replies

4. Shell Programming and Scripting

Perl search and replace file content.

I am not sure if this is doable. I am trying to open and print the content of the file by replacing all instances fo perl to PERL . This is my code but it is giving me the number count instead of the actual lines with changes. open (PERLHISTORY, 'sample.txt') or die "The file sample.txt could... (3 Replies)
Discussion started by: jxh461
3 Replies

5. Shell Programming and Scripting

Search for string in filename, not file content

How can I search for a string in a filename? For example, I want to know if a filename (not the file contents) contains the string "test". (3 Replies)
Discussion started by: daflore
3 Replies

6. UNIX for Dummies Questions & Answers

Using File Browser to search file content ...

Hello, I'm using rhel6. Using File Browser Nautilus 2.28.4 I could easily locate any file I'm interested in by it name. I'd like to use this File Browser to locate the file name based on it content e.g. based on some word in the text file. It doesn't work for me that way ... My question: does... (0 Replies)
Discussion started by: susja
0 Replies

7. Shell Programming and Scripting

Need to build Shell Script to search content of a text file into a folder consist several files

Have to read one file say sourcefile containing several words and having another folder containing several files. Now read the first word of Sourcefile & search it into the folder consisting sevral files, and create another file with result. We hhave to pick the filename of the file in which... (3 Replies)
Discussion started by: mukesh.baranwal
3 Replies

8. Shell Programming and Scripting

want to search some content of the file with specific to user

I have some users in one unix system and i want to search some files with specific to user and then i want to find some content inside that file so can u help me how we can implement it? File location is as below. /pools/home_unix/cmadireddy/work/models/model/ cmadireddy is user name. now... (6 Replies)
Discussion started by: lathigara
6 Replies

9. Shell Programming and Scripting

Searching the content of one file using the search key of another file

I have two files: file 1: hello.com neo.com,japan.com,example.com news.net xyz.com, telecom.net, highlands.net, software.com example2.com earth.net, abc.gov.uk file 2: neo.com example.com abc.gov.uk file 2 are the search keys to search in file 1 if any of the search key is... (3 Replies)
Discussion started by: csim_mohan
3 Replies

10. Shell Programming and Scripting

Search the specific content from the complex file

Hi, I have a file with complex data without delimiter, have requirement to fetch the specific record based on some charcters. here is my file data ... (12 Replies)
Discussion started by: Riverstone
12 Replies
monitor(3C)						   Standard C Library Functions 					       monitor(3C)

NAME
monitor - prepare process execution profile SYNOPSIS
#include <mon.h> void monitor(int (*lowpc(), int (*highpc)(), WORD *buffer, size_t bufsize, size_t nfunc); DESCRIPTION
The monitor() function is an interface to the profil(2) function and is called automatically with default parameters by any program created by the cc(1B) utility with the -p option specified. Except to establish further control over profiling activity, it is not necessary to explicitly call monitor(). When used, monitor() is called at least at the beginning and the end of a program. The first call to monitor() initiates the recording of two different kinds of execution-profile information: execution-time distribution and function call count. Execution-time distribution data is generated by profil() and the function call counts are generated by code supplied to the object file (or files) by cc(1B) -p. Both types of information are collected as a program executes. The last call to monitor() writes this collected data to the output file mon.out. The name of the file written by monitor() is controlled by the environment variable PROFDIR. If PROFDIR does not exist, the file mon.out is created in the current directory. If PROFDIR exists but has no value, monitor() does no profiling and creates no output file. If PROFDIR is dirname, and monitor() is called automatically by compilation with cc -p, the file created is dirname/pid.progname where progname is the name of the program. The lowpc and highpc arguments are the beginning and ending addresses of the region to be profiled. The buffer argument is the address of a user-supplied array of WORD (defined in the header <mon.h>). The buffer argument is used by moni- tor() to store the histogram generated by profil() and the call counts. The bufsize argument identifies the number of array elements in buffer. The nfunc argument is the number of call count cells that have been reserved in buffer. Additional call count cells will be allocated auto- matically as they are needed. The bufsize argument should be computed using the following formula: size_of_buffer = sizeof(struct hdr) + nfunc * sizeof(struct cnt) + ((highpc-lowpc)/BARSIZE) * sizeof(WORD) + sizeof(WORD) - 1 ; bufsize = (size_of_buffer / sizeof(WORD)); where: o lowpc, highpc, nfunc are the same as the arguments to monitor(); o BARSIZE is the number of program bytes that correspond to each histogram bar, or cell, of the profil() buffer; o the hdr and cnt structures and the type WORD are defined in the header <mon.h>. The default call to monitor() is as follows: monitor (&eprol, &etext, wbuf, wbufsz, 600); where: o eprol is the beginning of the user's program when linked with cc -p (see end(3C)); o etext is the end of the user's program (see end(3C)); o wbuf is an array of WORD with wbufsz elements; o wbufsz is computed using the bufsize formula shown above with BARSIZE of 8; o 600 is the number of call count cells that have been reserved in buffer. These parameter settings establish the computation of an execution-time distribution histogram that uses profil() for the entire program, initially reserves room for 600 call count cells in buffer, and provides for enough histogram cells to generate significant distribution- measurement results. For more information on the effects of bufsize on execution-distribution measurements, see profil(2). EXAMPLES
Example 1: Example to stop execution monitoring and write the results to a file. To stop execution monitoring and write the results to a file, use the following: monitor((int (*)())0, (int (*)())0, (WORD *)0, 0, 0); Use prof to examine the results. USAGE
Additional calls to monitor() after main() has been called and before exit() has been called will add to the function-call count capacity, but such calls will also replace and restart the profil() histogram computation. ATTRIBUTES
See attributes(5) for descriptions of the following attributes: +-----------------------------+-----------------------------+ | ATTRIBUTE TYPE | ATTRIBUTE VALUE | +-----------------------------+-----------------------------+ |MT-Level |Safe | +-----------------------------+-----------------------------+ SEE ALSO
cc(1B), profil(2), end(3C), attributes(5), prof(5) SunOS 5.10 29 Dec 1996 monitor(3C)
All times are GMT -4. The time now is 05:31 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy