Sponsored Content
Full Discussion: Using grep in find
Top Forums UNIX for Beginners Questions & Answers Using grep in find Post 303043289 by big123456 on Thursday 23rd of January 2020 09:47:42 AM
Old 01-23-2020
Thanks.
 

10 More Discussions You Might Find Interesting

1. Programming

find and grep

Hi, I need to find out a particular pattern from a directory, for example say X. The X directory contains 10 c files, and it has subdirectory called Y, and Y has 20 c files within it. Now I have to find out the pattern only from parent directory X not from sub directory Y. I have... (4 Replies)
Discussion started by: sarwan
4 Replies

2. Shell Programming and Scripting

find then grep

I have some patterns that I need to match with the content of several files and I'm having trouble to do it Here is what I tried already : ksh won't even execute this #!/bin/ksh path="/export/home/ipomwbas" pattern=$path"/flags" find . -name "*.properties" |\ while read file; do ... (7 Replies)
Discussion started by: flame_eagle
7 Replies

3. UNIX for Dummies Questions & Answers

grep and find

Hey, I have a question about using grep and find together to locate all C programs in a directory containing certain words and open the vi editor with each file. I'm not sure how to do this in one command (as in one line). I know find has a "-exec" option that can call vi, but how do you combine... (1 Reply)
Discussion started by: MEllis5
1 Replies

4. UNIX for Dummies Questions & Answers

find , grep

HI what is the difference between find and grep if I want to find all the files from different directories which contain "ORA" error, and the line number in each file which has ORA error should I use pipeline ? thanks James (3 Replies)
Discussion started by: james94538
3 Replies

5. Shell Programming and Scripting

Using Find w/ Grep?

Hey, I have a Find command like: find $searchDir -type f and this returns a list of files under the directory, which is all good, but, I want to filter that search for files that contain the string "people" I tried something like: find $searchDir -type f -exec grep "people" '{}'... (2 Replies)
Discussion started by: beefeater267
2 Replies

6. UNIX for Dummies Questions & Answers

Using find with a grep

:wall:Hello, Im having trouble using the find and grep combined into one command. I have the following: find filname* -mmin -60 grep "ERROR" filename I want to find the "ERROR" text in any file created in the last hour in the current directory. I dont know how to end the command. If I leave... (3 Replies)
Discussion started by: aispg8
3 Replies

7. UNIX for Dummies Questions & Answers

grep or find ?

I have a file called 'test.txt' that contains alphanumeric charecters. The file contains the word 'SBE' followed by other alphabets many times. For example, the file will contain: SBE334GH and also will have SBE77Y8I. When i do grep 'SBE*' test.txt - it outputs the entire file. Can you... (5 Replies)
Discussion started by: DallasT
5 Replies

8. Shell Programming and Scripting

How to use grep & find command to find references to a particular file

Hi all , I'm new to unix I have a checked project , there exists a file called xxx.config . now my task is to find all the files in the checked out project which references to this xxx.config file. how do i use grep or find command . (2 Replies)
Discussion started by: Gangam
2 Replies

9. UNIX for Dummies Questions & Answers

find/xargs/*grep: find multi-line empty "try-catch" blocks - eg, missing ; not in a commented block

How can I recursively find all files in a directory and print out the file and first line number of any text blocks that match the below cases? This would seem to involve find, xargs, *grep, regex, etc. In summary, I want to find so-called empty "try-catch blocks" that do not contain code... (0 Replies)
Discussion started by: lifechamp
0 Replies

10. Shell Programming and Scripting

Find and Grep

Is it possible with find and Grep to search files under a directory and display only files that have multiple occurrence of a string (In AIX)? Anybody has an example code? If not what are the other options? Thanks in advance. (7 Replies)
Discussion started by: J_ang
7 Replies
GETC_UNLOCKED(3P)					     POSIX Programmer's Manual						 GETC_UNLOCKED(3P)

PROLOG
This manual page is part of the POSIX Programmer's Manual. The Linux implementation of this interface may differ (consult the correspond- ing Linux manual page for details of Linux behavior), or the interface may not be implemented on Linux. NAME
getc_unlocked, getchar_unlocked, putc_unlocked, putchar_unlocked - stdio with explicit client locking SYNOPSIS
#include <stdio.h> int getc_unlocked(FILE *stream); int getchar_unlocked(void); int putc_unlocked(int c, FILE *stream); int putchar_unlocked(int c); DESCRIPTION
Versions of the functions getc(), getchar(), putc(), and putchar() respectively named getc_unlocked(), getchar_unlocked(), putc_unlocked(), and putchar_unlocked() shall be provided which are functionally equivalent to the original versions, with the exception that they are not required to be implemented in a thread-safe manner. They may only safely be used within a scope protected by flockfile() (or ftrylock- file()) and funlockfile(). These functions may safely be used in a multi-threaded program if and only if they are called while the invok- ing thread owns the ( FILE *) object, as is the case after a successful call to the flockfile() or ftrylockfile() functions. RETURN VALUE
See getc(), getchar(), putc(), and putchar(). ERRORS
See getc(), getchar(), putc(), and putchar(). The following sections are informative. EXAMPLES
None. APPLICATION USAGE
Since they may be implemented as macros, getc_unlocked() and putc_unlocked() may treat incorrectly a stream argument with side effects. In particular, getc_unlocked(*f++) and putc_unlocked(*f++) do not necessarily work as expected. Therefore, use of these functions in such sit- uations should be preceded by the following statement as appropriate: #undef getc_unlocked #undef putc_unlocked RATIONALE
Some I/O functions are typically implemented as macros for performance reasons (for example, putc() and getc()). For safety, they need to be synchronized, but it is often too expensive to synchronize on every character. Nevertheless, it was felt that the safety concerns were more important; consequently, the getc(), getchar(), putc(), and putchar() functions are required to be thread-safe. However, unlocked versions are also provided with names that clearly indicate the unsafe nature of their operation but can be used to exploit their higher performance. These unlocked versions can be safely used only within explicitly locked program regions, using exported locking primitives. In particular, a sequence such as: flockfile(fileptr); putc_unlocked('1', fileptr); putc_unlocked(' ', fileptr); fprintf(fileptr, "Line 2 "); funlockfile(fileptr); is permissible, and results in the text sequence: 1 Line 2 being printed without being interspersed with output from other threads. It would be wrong to have the standard names such as getc(), putc(), and so on, map to the "faster, but unsafe" rather than the "slower, but safe'' versions. In either case, you would still want to inspect all uses of getc(), putc(), and so on, by hand when converting exist- ing code. Choosing the safe bindings as the default, at least, results in correct code and maintains the "atomicity at the function" invariant. To do otherwise would introduce gratuitous synchronization errors into converted code. Other routines that modify the stdio ( FILE *) structures or buffers are also safely synchronized. Note that there is no need for functions of the form getc_locked(), putc_locked(), and so on, since this is the functionality of getc(), putc(), et al. It would be inappropriate to use a feature test macro to switch a macro definition of getc() between getc_locked() and getc_unlocked(), since the ISO C standard requires an actual function to exist, a function whose behavior could not be changed by the fea- ture test macro. Also, providing both the xxx_locked() and xxx_unlocked() forms leads to the confusion of whether the suffix describes the behavior of the function or the circumstances under which it should be used. Three additional routines, flockfile(), ftrylockfile(), and funlockfile() (which may be macros), are provided to allow the user to delin- eate a sequence of I/O statements that are executed synchronously. The ungetc() function is infrequently called relative to the other functions/macros so no unlocked variation is needed. FUTURE DIRECTIONS
None. SEE ALSO
getc(), getchar(), putc(), putchar(), the Base Definitions volume of IEEE Std 1003.1-2001, <stdio.h> COPYRIGHT
Portions of this text are reprinted and reproduced in electronic form from IEEE Std 1003.1, 2003 Edition, Standard for Information Technol- ogy -- Portable Operating System Interface (POSIX), The Open Group Base Specifications Issue 6, Copyright (C) 2001-2003 by the Institute of Electrical and Electronics Engineers, Inc and The Open Group. In the event of any discrepancy between this version and the original IEEE and The Open Group Standard, the original IEEE and The Open Group Standard is the referee document. The original Standard can be obtained online at http://www.opengroup.org/unix/online.html . IEEE
/The Open Group 2003 GETC_UNLOCKED(3P)
All times are GMT -4. The time now is 02:41 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy