10 More Discussions You Might Find Interesting
1. UNIX for Beginners Questions & Answers
Hi All,
I hope somebody would be able to help me.
I would need to search a string coming from a file, example file.txt:
dog
cat
goat
horse
fish
For every string, I would need to know if there are any files inside a directory(recursively) that contains the string regardless of case.... (9 Replies)
Discussion started by: kokoro
9 Replies
2. UNIX for Beginners Questions & Answers
Lets say I have a massive directory which is filled with other directories all filled with different c++ scripts and I want a listing of all the scripts that contain the string: "this string". Is there a way to use a grep search for that? I tried:
grep -lr "this string" *
but I do not... (3 Replies)
Discussion started by: Circuits
3 Replies
3. Shell Programming and Scripting
Hi All,
How to search for a string in all the files irrespective of directory.
If I use grep -i 'hello' *.*
It will search for the string hello in the files of current directory.
But I want to check for the string hello in the files of all the directories.
Thanks (4 Replies)
Discussion started by: ROCK_PLSQL
4 Replies
4. UNIX for Dummies Questions & Answers
Hi,
I have logfile like this..
=== 2014-02-09 15:46:59,936 INFO RequestContext - URL: '/eyisp/sc/skins/EY/images/pickers/comboBoxPicker_Over.png', User-Agent: 'Mozilla/5.0 (Windows NT 6.1; WOW64; Trident/7.0; rv:11.0) like Gecko': Unsupported with Accept-Encoding header
=== 2015-02-09... (8 Replies)
Discussion started by: kishk
8 Replies
5. UNIX for Dummies Questions & Answers
Hi,
Is there any way to use find command and search only specific subdirectories in a directory.
for example
/home/d1
/home/d2
/home/d3
i want to search in the following directories
/home
/home/d1
/home/d2
i do not want the find command to search the /home/d3 directory. (6 Replies)
Discussion started by: Little
6 Replies
6. UNIX for Dummies Questions & Answers
Hi,
I have log file which rolls out every second which is as this.
HttpGenRequest - -<!--OXi dbPublish--> <created="2014-03-24 23:45:37" lastMsgId="" requestTime="0.0333"> <response request="getOutcomeDetails" code="114" message="Request found no matching data" debug="" provider="undefined"/>... (3 Replies)
Discussion started by: karthikprakash
3 Replies
7. UNIX for Dummies Questions & Answers
I am new to Unix scripting and would like some help. Here is my scenario:
1) I have a text files that contains two fields: file name and retention period in months:
File1 36
file2 24
File3 12
2) The directory I am searching contains sequential files.
3) I need to be able to take the file name... (10 Replies)
Discussion started by: Mustafa19804
10 Replies
8. Shell Programming and Scripting
Hi,
I have following requirement. Pls suggest.
To search a string in a file which is combination of character and number(always 9 digit, but numeric). if found then caputure the exit return code as 0 else 1 , if 0 then next job can be triggerd. If exit code is 1, should return a failure... (10 Replies)
Discussion started by: zooby
10 Replies
9. Shell Programming and Scripting
I have to search a file in a prticular directory. filename will be passed through command line. The directory may contain subdirectory.
i.e.
suppose directory in /u03/appl (it can hard coded in script). This directory may contain subdirectory.
$ scriptname.sh filename
output should be... (2 Replies)
Discussion started by: jadoo_c2
2 Replies
10. UNIX for Dummies Questions & Answers
Hi Friends,
How can I search all files in all slices on a unix system for a particular string within the file.
e.g search string 'oracle'
Thanks (4 Replies)
Discussion started by: sureshy
4 Replies
GLOB(3) 1 GLOB(3)
glob - Find pathnames matching a pattern
SYNOPSIS
array glob (string $pattern, [int $flags])
DESCRIPTION
The glob(3) function searches for all the pathnames matching $pattern according to the rules used by the libc glob() function, which is
similar to the rules used by common shells.
PARAMETERS
o $pattern
- The pattern. No tilde expansion or parameter substitution is done.
o $flags
- Valid flags:
o GLOB_MARK - Adds a slash to each directory returned
o GLOB_NOSORT - Return files as they appear in the directory (no sorting). When this flag is not used, the pathnames are
sorted alphabetically
o GLOB_NOCHECK - Return the search pattern if no files matching it were found
o GLOB_NOESCAPE - Backslashes do not quote metacharacters
o GLOB_BRACE - Expands {a,b,c} to match 'a', 'b', or 'c'
o GLOB_ONLYDIR - Return only directory entries which match the pattern
o GLOB_ERR - Stop on read errors (like unreadable directories), by default errors are ignored.
RETURN VALUES
Returns an array containing the matched files/directories, an empty array if no file matched or FALSE on error.
Note
On some systems it is impossible to distinguish between empty match and an error.
CHANGELOG
+--------+--------------------+
|Version | |
| | |
| | Description |
| | |
+--------+--------------------+
| 5.1.0 | |
| | |
| | |
| | GLOB_ERR was added |
| | |
+--------+--------------------+
EXAMPLES
Example #1
Convenient way how glob(3) can replace opendir(3) and friends.
<?php
foreach (glob("*.txt") as $filename) {
echo "$filename size " . filesize($filename) . "
";
}
?>
The above example will output something similar to:
funclist.txt size 44686
funcsummary.txt size 267625
quickref.txt size 137820
NOTES
Note
This function will not work on remote files as the file to be examined must be accessible via the server's filesystem.
Note
This function isn't available on some systems (e.g. old Sun OS).
Note
The GLOB_BRACE flag is not available on some non GNU systems, like Solaris.
SEE ALSO
opendir(3), readdir(3), closedir(3), fnmatch(3).
PHP Documentation Group GLOB(3)