Search strings from a file in files in a directory recursively; then print the string with a status
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:
For every string, I would need to know if there are any files inside a directory(recursively) that contains the string regardless of case.
And then should be able to create a status report file based from the result of the search, and produce the following format:
report.txt
Thanks in advance!
Hi
i need to print pathname in which the string present using 'find' command
sample output like this
Pathname String to be searched
---------- --------------------
/usr/test/myfile get
/opt/test/somefile get
Thanks in... (4 Replies)
Hi ,
I have a directory structure as dir and subdirectories and files under it and so on.now I need to find the files which contain the search string under every dir and subdir and replace .
my search string is like
searchstring=/a/b
string to be replaced=/a/c/b
please help.
... (7 Replies)
I tried awk for this, but failed <or my code is not correct? I dont know>. Can anyone help me on this?
---------- Post updated at 08:34 PM ---------- Previous update was at 08:29 PM ----------
my working file looks like this:
<empty>
<empty>
<empty>
NAME :ABC AGE :15
GENDER... (6 Replies)
I have a file called po.txt. Here is the content of the file:
<!DOCTYPE PurchaseOrderMessage (View Source for full doctype...)>
- <PurchaseOrder>
- <Header>
<MessageId>cdb3062b-685b-4cd5-9633-013186750e10</MessageId>
<Timestamp>2011-08-01T13:47:23.536-04:00</Timestamp>
</Header>
-... (4 Replies)
Hi all,
how to recursively search for a list of keywords in a given directory??
for example:
suppose i have kept all the keywords in a file called "procnamelist" (in separate line)
and i have to search recursively in a directory called "target/dir"
if i am not doing recursive search then... (4 Replies)
I have a file with
<suit:run date="Trump Tue 06/19/2012 11:41 AM EDT" machine="garg-ln" build="19921" level="beta" release="6.1.5" os="Linux">
Need to find word "build" then
extract build number, which is 19921 also
release number, which is 6.1.5 then
concatenate them to one variable as... (6 Replies)
i have a file named keyword.csv(contains around 8k records) which contains a no. of columns.
The 5th column contains all the keywords.
I want to recursively search these keywords in all .pl files(around 1k) and display the filename....Afterthat i will use the filename and some of the column from... (3 Replies)
Hi guys,
I have a text file named file1.txt that is formatted like this:
001 , ID , 20000
002 , Name , Brandon
003 , Phone_Number , 616-234-1999
004 , SSNumber , 234-23-234
005 , Model , Toyota
007 , Engine ,V8
008 , GPS , OFF
and I have file2.txt formatted like this:
... (2 Replies)
Hi,
How can I use find command to search string/pattern in a file recursively?
What I tried:
find . -type f -exec cat {} | grep "make" \;
Output:
grep: find: ;: No such file or directory
missing argument to `-exec'
And this:
find . -type f -exec cat {} \; -exec grep "make" {} \;... (12 Replies)
Good Evening Folks -
I have a need to search a specific directory and ALL sub-directories for the following string:
Data Load UpdatedIf this string is found, I need to print content from the line directory above it between symbols, as well as the file name where it is found.
Here is a... (1 Reply)
Discussion started by: SIMMS7400
1 Replies
LEARN ABOUT PHP
db2_fetch_both
DB2_FETCH_BOTH(3) 1 DB2_FETCH_BOTH(3)db2_fetch_both - Returns an array, indexed by both column name and position, representing a row in a result setSYNOPSIS
array db2_fetch_both (resource $stmt, [int $row_number = -1])
DESCRIPTION
Returns an array, indexed by both column name and position, representing a row in a result set. Note that the row returned by
db2_fetch_both(3) requires more memory than the single-indexed arrays returned by db2_fetch_assoc(3) or db2_fetch_array(3).
PARAMETERS
o $stmt
- A valid stmt resource containing a result set.
o $row_number
- Requests a specific 1-indexed row from the result set. Passing this parameter results in a PHP warning if the result set uses a
forward-only cursor.
RETURN VALUES
Returns an associative array with column values indexed by both the column name and 0-indexed column number. The array represents the next
or requested row in the result set. Returns FALSE if there are no rows left in the result set, or if the row requested by $row_number does
not exist in the result set.
EXAMPLES
Example #1
Iterating through a forward-only cursor
If you call db2_fetch_both(3) without a specific row number, it automatically retrieves the next row in the result set. The follow-
ing example accesses columns in the returned array by both column name and by numeric index.
<?php
$sql = "SELECT id, name, breed, weight FROM animals ORDER BY breed";
$stmt = db2_prepare($conn, $sql);
$result = db2_execute($stmt);
while ($row = db2_fetch_both($stmt)) {
printf ("%-5d %-16s %-32s %10s
",
$row['ID'], $row[0], $row['BREED'], $row[3]);
}
?>
The above example will output:
0 Pook cat 3.20
5 Rickety Ride goat 9.70
2 Smarty horse 350.00
Example #2
Retrieving specific rows with db2_fetch_both(3) from a scrollable cursor
If your result set uses a scrollable cursor, you can call db2_fetch_both(3) with a specific row number. The following example
retrieves every other row in the result set, starting with the second row.
<?php
$sql = "SELECT id, name, breed, weight FROM animals ORDER BY breed";
$result = db2_exec($stmt, $sql, array('cursor' => DB2_SCROLLABLE));
$i=2;
while ($row = db2_fetch_both($result, $i)) {
printf ("%-5d %-16s %-32s %10s
",
$row[0], $row['NAME'], $row[2], $row['WEIGHT']);
$i = $i + 2;
}
?>
The above example will output:
0 Pook cat 3.20
5 Rickety Ride goat 9.70
2 Smarty horse 350.00
SEE ALSO db2_fetch_array(3), db2_fetch_assoc(3), db2_fetch_object(3), db2_fetch_row(3), db2_result(3).
PHP Documentation Group DB2_FETCH_BOTH(3)