guys,
my requirment goes like this:
I have a file, and wish to filter out records where
1. The first letter is o or O
and
2. The next 4 following letter should not be ther
I do not wish to use pipe and wish to do it in one shot.
The best expression I came up with is:
grep ^*... (10 Replies)
Hi, guys. I have one question, hope somebody can give me a hand
I have a file called passwd, the contents of it arebelow:
***********************
...
goldsimj:x:5008:200:
goldsij2:x:5009:200:
whitej:x:5010:201:
brownj:x:5011:202:
goldsij3:x:5012:204:
greyp:x:5013:203:
...... (6 Replies)
please can someone tell me what the following regrex means
grep "^aa*$" <file>
I thought this would match any word beginning with aa and ending with $, but it doesnt.
Thanks in advance
Calypso (7 Replies)
I have the following code:
ls -al /bin | tr -s ' ' | grep 'x'
ls -al: Lists all the files in a given director such as /bin
tr -s ' ': removes additional spaces between characters so that there is only one space
grep 'x': match all "x" characters that are followed by a whitespace.
I was... (3 Replies)
Hi,
I am executing a svnlook command to check to see if the following line exists. I need a regular expression to represent the line.
A /test/test1/qa/test2/index.html
A /test/test1/qa/test3/test.jpg
A /test/test1/qa/test3/test1.jpg
A /test/test1/qa/test4/test.swf
I just need to extract... (9 Replies)
Hi all,
How am I read a file, find the match regular expression and overwrite to the same files.
open DESTINATION_FILE, "<tmptravl.dat" or die "tmptravl.dat";
open NEW_DESTINATION_FILE, ">new_tmptravl.dat" or die "new_tmptravl.dat";
while (<DESTINATION_FILE>)
{
# print... (1 Reply)
i have a command line like this in csh script
grep -i "$argv$"
which i wanted to select the line ending with string provided as argument but it couldn't interpret the '$' (ending with)..
any help? (3 Replies)
Hi ,
I have few lines like
A20120101.ANU.ZIP
A20120401.ABC.ZIP
A20120105.KJK.ZIP
A20120809.JUG.ZIP
A20120101.MAT.ZIP
B20120301.ANU.XIP
I want to filter by
1. Files starting with A and Ending With Z ( ^A.*.ZIP$)
2. And either ANU, or KJK or MAT in the file name.
Hope my... (6 Replies)
I want to track only below:
I am using below, but it doesn't work: (6 Replies)
Discussion started by: proactiveaditya
6 Replies
LEARN ABOUT PHP
glob
GLOB(3) 1 GLOB(3)glob - Find pathnames matching a patternSYNOPSIS
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)