Sponsored Content
Top Forums Shell Programming and Scripting Search on date range of file based on user input Post 302616147 by lostincashe on Friday 30th of March 2012 02:32:36 PM
Old 03-30-2012
Thanks very much, I will try this when I am next at work on Monday.
I was not aware of the IFS "/" so it was interesting to read your post.
Thanks againSmilie
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Log File date compare for user defined range

:confused: Hi i am a noob and need a little help to finish my shell script. I am learning as i go but hit a problem. I am search thorugh logs(*.rv) files to find entires between two user defined dates, The script so far looks for the "START" and "END" of each entry at sees if it belongs To... (0 Replies)
Discussion started by: mojo24
0 Replies

2. Shell Programming and Scripting

Report file extraction based on Date range

Hi all, Iam writing a script, which will extract all the files from Start_Date to End_Date. Files are date stamped as YYYYMMDD. For ex: Start_Date='20051001' End_Date='20060331' extract files such as........ ramp_20050810.rpt ramp_20050915.rpt ramp_20051001.rpt ramp_20051010.rpt... (2 Replies)
Discussion started by: ganapati
2 Replies

3. Shell Programming and Scripting

search file, change existing value based on input (awk help)

I have a file (status.file) of the form: valueA 3450 valueB -20 valueC -340 valueD 48 I am tailing a data.file, and need to search and modify a value in status.file...the tail is: tail -f data.file | awk '{ print $3, ($NF - $(NF-1)) }' which will produce lines that look like this: ... (3 Replies)
Discussion started by: nortonloaf
3 Replies

4. Shell Programming and Scripting

Append file based upon user input-- solved

Ok, I have a script with a commandline option that allows the user to add a custom function to the script file. I have tried everything in my limited knowledge of sed to get this to work and keep coming up short. I need sed to search for a line starting with a pattern, I've got that part so far,... (0 Replies)
Discussion started by: DC Slick
0 Replies

5. Shell Programming and Scripting

Search for a specific data in a file based on a date range

Hi, Currently I am working on a script to automate the process of converting the log file from binary into text format. To achieve this, partly I am depending on my application’s utility for this conversion and the rest I am relying on shell commands to search for directory, locate the file and... (5 Replies)
Discussion started by: svajhala
5 Replies

6. Shell Programming and Scripting

display Range of date depend on user input php

Hi, i am very new to php Is it possible to display Range of date depend on user input day example: user input 2 day start from 28/4/12 it will add 2 day from date of input so display should look like this 28/4/12 to 30/4/12 then from 30/412 user add another 4 date so will... (0 Replies)
Discussion started by: guidely
0 Replies

7. UNIX for Advanced & Expert Users

Help with ksh script to list, then cp files from a user input date range

Hi, I'm quite new to ksh scripting, can someone help me with this. Requirements: I need to create a script that list the files from a user input date range. e. g. format of file: *c1*log.2012-12-22-14-00* *c1*log.2012-12-22-14-00* *c1*log.2012-12-22-14-00*... (1 Reply)
Discussion started by: chococrunch6
1 Replies

8. UNIX for Dummies Questions & Answers

Find the count of files by last created date based on the given date range

My unix version is IBM AIX Version 6.1 I tried google my requirement and found the below answer, find . -newermt “2012-06-15 08:13" ! -newermt “2012-06-15 18:20" But newer command is not working in AIX version 6.1 unix I have given my requirement below: Input: atr files: ... (1 Reply)
Discussion started by: yuvaa27
1 Replies

9. Shell Programming and Scripting

Bash to search file based off user input then create new file

In the below bash a file is downloaded when the program is opened and then that file is searched based on user input and the result is written to a new file. For example, the bash is opened and the download.txt is downloaded, the user then enters the id (NA04520). The id is used to search... (5 Replies)
Discussion started by: cmccabe
5 Replies

10. Shell Programming and Scripting

awk command to search based on 5 user input fields

Field1=”” Field2=”” Field3=”” Field4=”” Field5=”” USER INPUT UP TO 5 FIELDS awk -F , '{ if ( $3 == Field1 && $6 == Field2 && $8 == Field3 && $9 == Field4 && $10 == Field5) print $0 }' /tmp/rodney.outD INPUT FILE (Rodney.outD): ... (3 Replies)
Discussion started by: rmerrird
3 Replies
SOCKET_SELECT(3)							 1							  SOCKET_SELECT(3)

socket_select - Runs the select() system call on the given arrays of sockets with a specified timeout

SYNOPSIS
int socket_select (array &$read, array &$write, array &$except, int $tv_sec, [int $tv_usec]) DESCRIPTION
socket_select(3) accepts arrays of sockets and waits for them to change status. Those coming with BSD sockets background will recognize that those socket resource arrays are in fact the so-called file descriptor sets. Three independent arrays of socket resources are watched. PARAMETERS
o $read - The sockets listed in the $read array will be watched to see if characters become available for reading (more precisely, to see if a read will not block - in particular, a socket resource is also ready on end-of-file, in which case a socket_read(3) will return a zero length string). o $write - The sockets listed in the $write array will be watched to see if a write will not block. o $except - The sockets listed in the $except array will be watched for exceptions. o $tv_sec - The $tv_sec and $tv_usec together form the timeout parameter. The timeout is an upper bound on the amount of time elapsed before socket_select(3) return. $tv_sec may be zero , causing socket_select(3) to return immediately. This is useful for polling. If $tv_sec is NULL (no timeout), socket_select(3) can block indefinitely. o $tv_usec - Warning On exit, the arrays are modified to indicate which socket resource actually changed status. You do not need to pass every array to socket_select(3). You can leave it out and use an empty array or NULL instead. Also do not forget that those arrays are passed by reference and will be modified after socket_select(3) returns. Note Due a limitation in the current Zend Engine it is not possible to pass a constant modifier like NULL directly as a parameter to a function which expects this parameter to be passed by reference. Instead use a temporary variable or an expression with the leftmost member being a temporary variable: Example #1 Using NULL with socket_select(3) <?php $e = NULL; socket_select($r, $w, $e, 0); ?> RETURN VALUES
On success socket_select(3) returns the number of socket resources contained in the modified arrays, which may be zero if the timeout expires before anything interesting happens. On error FALSE is returned. The error code can be retrieved with socket_last_error(3). Note Be sure to use the === operator when checking for an error. Since the socket_select(3) may return 0 the comparison with == would evaluate to TRUE: Example #2 Understanding socket_select(3)'s result <?php $e = NULL; if (false === socket_select($r, $w, $e, 0)) { echo "socket_select() failed, reason: " . socket_strerror(socket_last_error()) . " "; } ?> EXAMPLES
Example #3 socket_select(3) example <?php /* Prepare the read array */ $read = array($socket1, $socket2); $write = NULL; $except = NULL; $num_changed_sockets = socket_select($read, $write, $except, 0); if ($num_changed_sockets === false) { /* Error handling */ } else if ($num_changed_sockets > 0) { /* At least at one of the sockets something interesting happened */ } ?> NOTES
Note Be aware that some socket implementations need to be handled very carefully. A few basic rules: o You should always try to use socket_select(3) without timeout. Your program should have nothing to do if there is no data available. Code that depends on timeouts is not usually portable and difficult to debug. o No socket resource must be added to any set if you do not intend to check its result after the socket_select(3) call, and respond appropriately. After socket_select(3) returns, all socket resources in all arrays must be checked. Any socket resource that is available for writing must be written to, and any socket resource available for reading must be read from. o If you read/write to a socket returns in the arrays be aware that they do not necessarily read/write the full amount of data you have requested. Be prepared to even only be able to read/write a single byte. o It's common to most socket implementations that the only exception caught with the $except array is out-of-bound data received on a socket. SEE ALSO
socket_read(3), socket_write(3), socket_last_error(3), socket_strerror(3). PHP Documentation Group SOCKET_SELECT(3)
All times are GMT -4. The time now is 07:51 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy