Sponsored Content
Full Discussion: Recursive grep
Top Forums UNIX for Dummies Questions & Answers Recursive grep Post 302195948 by era on Friday 16th of May 2008 08:55:29 AM
Old 05-16-2008
The variable in Jim's example can't be named results.txt; just change it to e.g. "file" and you should be fine.

Anything with significant spaces in it should be double-quoted.
 

9 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

grep recursive directories

I am trying to locate a file or files with specific data in them. Problem is the file(s) could reside in any one of many directories. My question is. Is there a way of recursively greping directories for the file(s) with the data I am looking for. I have tried - 1. $HOME> grep 47518 | ls... (8 Replies)
Discussion started by: jagannatha
8 Replies

2. UNIX for Dummies Questions & Answers

recursive GREP ?

Hi! Suppose I have a directory (no symbolic links) called /WORK that contains 3 subdirectories: /A /B /C My problem is this: I want to look for a file that contains an order number. So far, I obtain what I want by doing this /home/acb% cd /WORK/A /home/acb/WORK/A% grep '093023553' *.*... (3 Replies)
Discussion started by: alan
3 Replies

3. UNIX for Dummies Questions & Answers

recursive grep output

I'm using this command to get a recursive grep find . -name *.i -exec grep 'blah blah' {} \; -exec ls {} \; now I would like to obtain just the list of the files and not also the line of the file. How should I change the syntax? thank you, (5 Replies)
Discussion started by: f_o_555
5 Replies

4. Shell Programming and Scripting

Preventing an endless loop with recursive grep

When finding a string in files within a directory, one can use this: grep -r "searchstring" dir/subdir/ > listofoccurrences.txt For brevity sake one can enter the intended directory and use this: grep -r "searchstring" . > listofoccurrences.txt which as I found out leads to an endless loop,... (2 Replies)
Discussion started by: figaro
2 Replies

5. UNIX for Advanced & Expert Users

recursive grep

Hi, on AIX 6.1 , in man document for grep : -r Searches directories recursively. By default, links to directories are followed. But when I use : oracle@XXX:/appli/XXX_SCRIPTS#grep -r subject *.sh It returns nothing. However I have at least one row in a file : ... (3 Replies)
Discussion started by: big123456
3 Replies

6. Shell Programming and Scripting

Tricky recursive removal (find with grep)

Tricky one: I want to do several things all at once to blow away a directory (rm -rf <dir>) 1) I want to find all files recursively that have a specific file extension (.ver) for example. 2) Then in that file, I want to grep for an expression ( "sp2" ) for example. 3) Then I want to... (1 Reply)
Discussion started by: jvsrvcs
1 Replies

7. Shell Programming and Scripting

Recursive Grep with replace

I have seen some useful infomation about recursive grep in one of the thread. Can it is possible to combine resursive grep and replace togather? Means I need to replace old server names in all the files with new server names as we are upgrading our applications. There are lots of files in... (2 Replies)
Discussion started by: yale_work
2 Replies

8. Shell Programming and Scripting

Recursive find / grep within a file / count of a string

Hi All, This is the first time I have posted to this forum so please bear with me. Thanks also advance for any help or guidance. For a project I need to do the following. 1. There are multiple files in multiple locations so I need to find them and the location. So I had planned to use... (9 Replies)
Discussion started by: Charlie6742
9 Replies

9. UNIX for Advanced & Expert Users

Recursive grep with only certain types of files

Can I please have some ideas on how to do a recursive grep with certain types of files? The file types I want to use are *.c and *.java. I know this normally works with all files. grep -riI 'scanner' /home/bob/ 2>/dev/null Just not sure how to get it to work *.c and *.java files. (5 Replies)
Discussion started by: cokedude
5 Replies
OPENPAM_READWORD(3)					   BSD Library Functions Manual 				       OPENPAM_READWORD(3)

NAME
openpam_readword -- read a word from a file, respecting shell quoting rules LIBRARY
Pluggable Authentication Module Library (libpam, -lpam) SYNOPSIS
#include <sys/types.h> #include <stdio.h> #include <security/pam_appl.h> #include <security/openpam.h> char * openpam_readword(FILE *f, int *lineno, size_t *lenp); DESCRIPTION
The openpam_readword() function reads the next word from a file, and returns it in a NUL-terminated buffer allocated with malloc(3). A word is a sequence of non-whitespace characters. However, whitespace characters can be included in a word if quoted or escaped according to the following rules: o An unescaped single or double quote introduces a quoted string, which ends when the same quote character is encountered a second time. The quotes themselves are stripped. o Within a single- or double-quoted string, all whitespace characters, including the newline character, are preserved as-is. o Outside a quoted string, a backslash escapes the next character, which is preserved as-is, unless that character is a newline, in which case it is discarded and reading continues at the beginning of the next line as if the backslash and newline had not been there. In all cases, the backslash itself is discarded. o Within a single-quoted string, double quotes and backslashes are preserved as-is. o Within a double-quoted string, a single quote is preserved as-is, and a backslash is preserved as-is unless used to escape a double quote. In addition, if the first non-whitespace character on the line is a hash character (#), the rest of the line is discarded. If a hash charac- ter occurs within a word, however, it is preserved as-is. A backslash at the end of a comment does cause line continuation. If lineno is not NULL, the integer variable it points to is incremented every time a quoted or escaped newline character is read. If lenp is not NULL, the length of the word (after quotes and backslashes have been removed) is stored in the variable it points to. RETURN VALUES
If successful, the openpam_readword() function returns a pointer to a dynamically allocated NUL-terminated string containing the first word encountered on the line. The caller is responsible for releasing the returned buffer by passing it to free(3). If openpam_readword() reaches the end of the line or file before any characters are copied to the word, it returns NULL. In the former case, the newline is pushed back to the file. If openpam_readword() reaches the end of the file while a quote or backslash escape is in effect, it sets errno to EINVAL and returns NULL. IMPLEMENTATION NOTES
The parsing rules are intended to be equivalent to the normal POSIX shell quoting rules. Any discrepancy is a bug and should be reported to the author along with sample input that can be used to reproduce the error. SEE ALSO
openpam_readline(3), openpam_readlinev(3), pam(3) STANDARDS
The openpam_readword() function is an OpenPAM extension. AUTHORS
The openpam_readword() function and this manual page were developed by Dag-Erling Smorgrav <des@des.no>. BSD
September 12, 2014 BSD
All times are GMT -4. The time now is 04:05 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy