04-17-2009
The biggest problem with your regexp is the greedy match .* but your search criteria is too vague to want to try and post any code. For example, why does asdfxx.p but not xx5.p? Of course your regexp will not match asdfxx.p anyway. Please post some real sample data and explain the search criteria in more detail.
10 More Discussions You Might Find Interesting
1. Shell Programming and Scripting
Hi there,
is it possible to use wild cards in this statement
ssh $remote_server 'perl -pi -e "s,EXP_SERIAL_19b8be67=\"\",EXP_SERIAL_`hostid`=\"UNKNOWN\"," /var/myfile'
This command works fine but the bit in bold (the 8 character hostid) will not always be 19b8be67 so I was hoping I could... (2 Replies)
Discussion started by: hcclnoodles
2 Replies
2. Shell Programming and Scripting
Hi,
I am writing a Perl script that reads in many lines, if a line meets the criteria I want to edit, it. For example, the script will return the following example line... test=abc123
All I want to do is strip off the "test=" and just be left with the abc123. In my script I can easily... (3 Replies)
Discussion started by: edrichard
3 Replies
3. Shell Programming and Scripting
File1.xml
<?xml version.........>
- <abcd:abcd_list version="1" www.john_uncle's_server.com" xmlns:
- <device id="100">
<firmware>12.4(3d)</firmware>
<location id="500">Sitting Room</location>
</device>
- <device id="101">
<firmware>12.4(3d)</firmware>
<location id="501">Class... (1 Reply)
Discussion started by: sureshcisco
1 Replies
4. Shell Programming and Scripting
I have a question regarding Perl scripting.
If I want to say open files that all look like this and assign them to a filehandle and then assign the filehandle to a variable, how do I do this?
The file names are
strand1.fa.gz.tmp
strand2.fa.gz.tmp
strand3.fa.gz.tmp
strand4.fa.gz.tmp
...... (6 Replies)
Discussion started by: japaneseguitars
6 Replies
5. Shell Programming and Scripting
Can Anyone tell me how to extract the second column of a xls sheet
And compare the content of each row of the column with a .h file.
xls sheet is having only one spreadsheet. (2 Replies)
Discussion started by: suvenduperl
2 Replies
6. Shell Programming and Scripting
Hi
I have 2 directories t1 and t2 with some files in it. I have to see whether the files present in t1 is also there in t2 or not. Currently, both the directories contain the same files as shown below:
$ABC.TXT
def.txt
Now, when I run the below script, it tells def.txt is found,... (5 Replies)
Discussion started by: guruprasadpr
5 Replies
7. Shell Programming and Scripting
Hi, my problem is that I have two files. File no. 1 is a gff text file (say gi1) that has gene information like :
********************
gene 39389788..39395643
/gene="RPSA"
/note="Derived by automated computational analysis using
... (2 Replies)
Discussion started by: reena2305
2 Replies
8. Shell Programming and Scripting
I have hundreds of files to process. In each file
I need to look for a pattern then
extract value(s) from next line and then
search for value(s) selected from point (2) in the same file at a specific position.
HEADER ELECTRON TRANSPORT 18-MAR-98 1A7V
TITLE CYTOCHROME... (7 Replies)
Discussion started by: AshwaniSharma09
7 Replies
9. Shell Programming and Scripting
Hi everyone,
I'm a perl newbie and need your help to extract a word inside the list of files with same pattern.
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<ns2:mycode xmlns:ns2="http://www.abcd.com/pqrs/acfSchema-2007a.xsd">
<id>10</id>
<name>PaymentServices</name>
... (7 Replies)
Discussion started by: jhamaks
7 Replies
10. Shell Programming and Scripting
Hi,
I have a log file which is the output from a xml script :
<?xml version="1.0" ?>
<!DOCTYPE svc_result SYSTEM "MLP_SVC_RESULT_320.DTD">
<svc_result ver="3.2.0">
<slia ver="3.0.0">
<pos>
<msid type="MSISDN" enc="ASC">8093078040</msid>
<poserr>
... (4 Replies)
Discussion started by: arjunstarz
4 Replies
LEARN ABOUT PHP
imap_search
IMAP_SEARCH(3) 1 IMAP_SEARCH(3)
imap_search - This function returns an array of messages matching the given search criteria
SYNOPSIS
array imap_search (resource $imap_stream, string $criteria, [int $options = SE_FREE], [string $charset = NIL])
DESCRIPTION
This function performs a search on the mailbox currently opened in the given IMAP stream.
For example, to match all unanswered messages sent by Mom, you'd use: "UNANSWERED FROM mom". Searches appear to be case insensitive. This
list of criteria is from a reading of the UW c-client source code and may be incomplete or inaccurate (see also RFC2060, section 6.4.4).
PARAMETERS
o $
imap_stream -An IMAP stream returned by imap_open(3).
o $criteria
- A string, delimited by spaces, in which the following keywords are allowed. Any multi-word arguments (e.g. FROM "joey smith")
must be quoted. Results will match all $criteria entries.
o ALL - return all messages matching the rest of the criteria
o ANSWERED - match messages with the \ANSWERED flag set
o BCC "string" - match messages with "string" in the Bcc: field
o BEFORE "date" - match messages with Date: before "date"
o BODY "string" - match messages with "string" in the body of the message
o CC "string" - match messages with "string" in the Cc: field
o DELETED - match deleted messages
o FLAGGED - match messages with the \FLAGGED (sometimes referred to as Important or Urgent) flag set
o FROM "string" - match messages with "string" in the From: field
o KEYWORD "string" - match messages with "string" as a keyword
o NEW - match new messages
o OLD - match old messages
o ON "date" - match messages with Date: matching "date"
o RECENT - match messages with the \RECENT flag set
o SEEN - match messages that have been read (the \SEEN flag is set)
o SINCE "date" - match messages with Date: after "date"
o SUBJECT "string" - match messages with "string" in the Subject:
o TEXT "string" - match messages with text "string"
o TO "string" - match messages with "string" in the To:
o UNANSWERED - match messages that have not been answered
o UNDELETED - match messages that are not deleted
o UNFLAGGED - match messages that are not flagged
o UNKEYWORD "string" - match messages that do not have the keyword "string"
o UNSEEN - match messages which have not been read yet
o $options
- Valid values for $options are SE_UID, which causes the returned array to contain UIDs instead of messages sequence numbers.
o $charset
-
RETURN VALUES
Returns an array of message numbers or UIDs.
Return FALSE if it does not understand the search $criteria or no messages have been found.
EXAMPLES
Example #1
imap_search(3) example
<?php
$conn = imap_open('{imap.example.com:993/imap/ssl}INBOX', 'foo@example.com', 'pass123', OP_READONLY);
$some = imap_search($conn, 'SUBJECT "HOWTO be Awesome" SINCE "8 August 2008"', SE_UID);
$msgnos = imap_search($conn, 'ALL');
$uids = imap_search($conn, 'ALL', SE_UID);
print_r($some);
print_r($msgnos);
print_r($uids);
?>
The above example will output something similar to:
Array
(
[0] => 4
[1] => 6
[2] => 11
)
Array
(
[0] => 1
[1] => 2
[2] => 3
[3] => 4
[4] => 5
[5] => 6
)
Array
(
[0] => 1
[1] => 4
[2] => 6
[3] => 8
[4] => 11
[5] => 12
)
SEE ALSO
imap_listscan(3).
PHP Documentation Group IMAP_SEARCH(3)