making a list matching certain criteria in bash...


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting making a list matching certain criteria in bash...
# 1  
Old 04-28-2009
making a list matching certain criteria in bash...

Hello everyone!I am trying to make a mail list(a simple .txt file)in which i put certain records that match specific criteria.
Let's say that i have a(sorted by last column file)like this one:

0100567 Bla1 Lala1 100
1234567 Bla2 Lala2 80
8769029 Bla3 Lala3 70
1001007 Bla4 Lala4 10

What i need to do is to redirect the whole first line in the mail list file.If I had another record with '100' in the 4th column,that should enter the mail list too...So you understand that records that enter that mail list are only those who have the highest number in the 4th column(not every time '100',only in this example).
There is no way(and no need) to know the numbers in that last column,the only thing i know is that they are sorted from high to low.


//Nevermind solved it

//if anyone answers this,please tell me how i can send mail from that list...

Last edited by bashuser2; 04-28-2009 at 08:11 AM..
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. UNIX for Beginners Questions & Answers

How to sort file with certain criteria (bash)?

I am running a command that is part of a script and this is what I am getting when it is sorted by the command: command: ls /tmp/test/*NDMP*.z /tmp/test/CARS-GOLD-NET_CHROMJOB-01-XZ-ARCHIVE-NDMP.z /tmp/test/CARS-GOLD-NET_CHROMJOB-01-XZ-NDMP.z... (2 Replies)
Discussion started by: newbie2010
2 Replies

2. Linux

Merge two files based on matching criteria

Hi, I am trying to merge two csv files based on matching criteria: File description is as below : Key_File : 000|ÇÞ|Key_HF|ÇÞ|Key_FName 001|ÇÞ|Key_11|ÇÞ|Sort_Key22|ÇÞ|Key_31 002|ÇÞ|Key_12|ÇÞ|Sort_Key23|ÇÞ|Key_32 003|ÇÞ|Key_13|ÇÞ|Sort_Key24|ÇÞ|Key_33 050|ÇÞ|Key_15|ÇÞ|Sort_Key25|ÇÞ|Key_34... (3 Replies)
Discussion started by: PK29
3 Replies

3. Shell Programming and Scripting

Renumber position 88-94 inside all files matching criteria inside folder

There are 4 files inside one folder matching criteria i.e. File name = ABCJmdmfbsjopXXXXXXX_mm-dd-yyyy_XXX.data Here is the Code which find the files matching criteria:- TS=`date +"%m-%d-%Y"`| for fname in `find . -name "ABCJmdmfbsjop???????_${TS}*.data"` do # Matching File Processing Code.... (1 Reply)
Discussion started by: lancesunny
1 Replies

4. Shell Programming and Scripting

changing the file-name in a directory for all files matching a particular criteria

i have a directory which consist of multiple files out of which there are some files that has -e in their name. I want to write a script that will change all those file-name to -l example there are some files with name : file1-e.wav file2-e.wav file3-english-e.wav file-4-e.wav ... (3 Replies)
Discussion started by: mukulverma2408
3 Replies

5. Shell Programming and Scripting

Find and replace string matching criteria

Dear Friends, I am looking for a way to replace a string (multiple lines) starting with something and ending with something (these two values do not change) with blank. Basically I want to delete this code injection accross many sites and folders. Search Code (across files and folders) that... (2 Replies)
Discussion started by: libras
2 Replies

6. UNIX for Dummies Questions & Answers

How to fetch files right below based on some matching criteria?

I have a requirement where in i need to select records right below the search criteria qwertykeyboard white 10 20 30 30 40 50 60 70 80 qwertykeyboard black 40 50 60 70 90 100 qwertykeyboard and white are headers separated by a tab. when i execute my script..i would be searching... (4 Replies)
Discussion started by: vinnu10
4 Replies

7. Shell Programming and Scripting

Remove duplicate lines (the first matching line by field criteria)

Hello to all, I have this file 2002 1 23 0 0 2435.60 131.70 5.60 20.99 0.89 0.00 285.80 2303.90 2002 1 23 15 0 2436.60 132.90 6.45 21.19 1.03 0.00 285.80 2303.70 2002 1 23 ... (6 Replies)
Discussion started by: joggdial3000
6 Replies

8. Shell Programming and Scripting

Script move and rename based on matching criteria

Hi all, i would like to create a script that move and rename files from all the subdirectories of a given directory to others subdirectories of the same directory based on "matching" criteria in the "from" and "to" parameters. Example: Begin script from /home/test/1_T_2008* move to... (3 Replies)
Discussion started by: braidomik
3 Replies

9. AIX

Simultaneous searching for files (names matching certain criteria) in several directo

Hello everyone, My OS is AIX 5.2 I would like some help in getting command syntax that does the following: 1. Searches simultaneously several directories downward; 2. Checks every subdirectory in each directory (and so on...) for file names that contain certain characters such as “~”, start... (0 Replies)
Discussion started by: Hopeful
0 Replies

10. Shell Programming and Scripting

deleting files and folders matching criteria

Hello, I'm spendind hours trying to figure out how a script could remove files and folders older than 30days in a given volume (/dataVolumes/Booba.1.0). Within this volume, all users have their personal folder that starts with "RC-..", so the script should skip them for deletion. I will... (4 Replies)
Discussion started by: H3001
4 Replies
Login or Register to Ask a Question
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)