Sponsored Content
Top Forums Shell Programming and Scripting Should pick latest file within past 3 days using UNIX script and perform steps in message below. Post 303008658 by Corona688 on Monday 4th of December 2017 04:27:58 PM
Old 12-04-2017
Step 1 is a problem since you can't have more than one file with the same name.
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

ls latest 4 days or specify days of files in the directory

Hi, I would like to list latest 2 days, 3 days or 4 days,etc of files in the directory... how? is it using ls? (3 Replies)
Discussion started by: happyv
3 Replies

2. Shell Programming and Scripting

Script to pick out files from a file which are older than 15 days

Hi , I have a file abc.txt which actually contains a directory and file list -rwxrwxr-x 1 dmadmin mmasapp 334 Dec 03 2001 aafs_006.ksh -rwxrwxr-x 1 dmadmin mmasapp 1270 Nov 13 2001 mcl_deposit_ftp.ksh -rwxrwxr-x 1 dmadmin mmasapp 925 Oct 31 2001 ... (1 Reply)
Discussion started by: viv1
1 Replies

3. UNIX for Dummies Questions & Answers

creating a CSV file for past 7 days

I have a requirement which will select the files with a specific naming convention which got created in past 7 days in a specific directory.Lets say the directory is /data/XYZ and the file names follow the below nomenclature like Daily_File*.txt I just need to create one CSV file which will... (12 Replies)
Discussion started by: dr46014
12 Replies

4. Shell Programming and Scripting

find files from the past 7 days

Hi All, I have a file which contains the listing of another directory: >cat list.dat -rwxr-xr-x 1 test staff 10240 Oct 02 06:53 test.txtdd -rwxrwxrwx 1 test staff 0 Oct 04 07:22 test.txx -rwxrwxrwx 1 test staff 132 Sep 16 2007 test_tt.sh... (6 Replies)
Discussion started by: deepakgang
6 Replies

5. UNIX for Dummies Questions & Answers

unix script that will pick up first 10 file

Suppose I have a unix file which contain a lost of 60 files like filename1 filename2 ... .. ... filename60 I want to write a unix script that will pick up first 10 files in first run 10-20 files in 2 run 20-30 files in 3 run 30-40 files in 4 run 40-50 files in 5 run 50-60 files in 6... (1 Reply)
Discussion started by: er_zeeshan05
1 Replies

6. Shell Programming and Scripting

how can i pick the latest log file as per below

in the below .. i want to pick the latest logfile which is having JPS.PR inside.. that means i want particularly "spgport040408041223.log:@@@@@@@@ 04:13:09 Adding: JPS.PR." which is latest among these.. is it possible to compare the current time with logfile time ? reptm@xblr0758rop>... (4 Replies)
Discussion started by: mail2sant
4 Replies

7. UNIX for Dummies Questions & Answers

pick the very latest directory

Hi, I have some list of directories in the form datemonthyear e.g. 02082009, 03082009 and 04082009 etc. I need to pick the latest directory from the current working directory. Outcome: 05082009 This is the output am expecting. Thanks (6 Replies)
Discussion started by: venkatesht
6 Replies

8. UNIX for Dummies Questions & Answers

Need command to pick the latest file

Hi In my script i am trying to access mainframe server using FTP, in the server i have filee with the timestamp.I need to get the file with the latest timestamp among them . The server has the below files / ftp> cd /outbox 250 CWD command successful ftp> ls 200 PORT command successful... (4 Replies)
Discussion started by: laxmi131
4 Replies

9. Shell Programming and Scripting

to pick the latest file modified in a directory

I wan to pick the latest modified file name and redirect it to a file .. ls -tr | tail -1 >file but this is printing file ins side the filename , can anyone help me out (5 Replies)
Discussion started by: vishwakar
5 Replies

10. Shell Programming and Scripting

I have this list of files . Now I will have to pick the latest file based on some condition

3679 Jul 21 23:59 belk_rpo_error_**po9324892**_07212014.log 0 Jul 22 23:59 belk_rpo_error_**po9324892**_07222014.log 3679 Jul 23 23:59 belk_rpo_error_**po9324892**_07232014.log 22 Jul 22 06:30 belk_rpo_error_**po9324267**_07012014.log 0 Jul 20 05:50... (5 Replies)
Discussion started by: LoneRanger
5 Replies
PICK(1) 							     [nmh-1.5]								   PICK(1)

NAME
pick - search for messages by content SYNOPSIS
pick [+folder] [msgs] [-and ...] [-or ...] [-not ...] [-lbrace ... -rbrace] [--component pattern] [-cc pattern] [-date pattern] [-from pattern] [-search pattern] [-subject pattern] [-to pattern] [-after date] [-before date] [-datefield field] [-sequence name ...] [-public | -nopublic] [-zero | -nozero] [-list | -nolist] [-version] [-help] typical usage: scan `pick -from jones` pick -to holloway -sequence select show `pick -before friday` DESCRIPTION
Pick searches within a folder for messages with the specified contents, and then identifies those messages. Two types of search primitives are available: pattern matching and date constraint operations. A modified grep(1) is used to perform the matching, so the full regular expression (see ed(1)) facility is available within pattern. With -search, pattern is used directly, and with the others, the grep pattern constructed is: `component[ ]*:.*pattern' This means that the pattern specified for a -search will be found everywhere in the message, including the header and the body, while the other pattern matching requests are limited to the single specified component. The expression `--component pattern' is a shorthand for specifying `-search "component[ ]*:.*pattern" ' It is used to pick a component which is not one of "To:", "cc:", "Date:", "From:", or "Subject:". An example is "pick --reply-to pooh". Pattern matching is performed on a per-line basis. Within the header of the message, each component is treated as one long line, but in the body, each line is separate. Lower-case letters in the search pattern will match either lower or upper case in the message, while upper case will match only upper case. Note that since the -date switch is a pattern matching operation (as described above), to find messages sent on a certain date the pattern string must match the text of the "Date:" field of the message. Independent of any pattern matching operations requested, the switches -after date or -before date may also be used to introduce date/time constraints on all of the messages. By default, the "Date:" field is consulted, but if another date yielding field (such as "BB-Posted:" or "Delivery-Date:") should be used, the -datefield field switch may be used. With -before and -after, pick will actually parse the date fields in each of the messages specified in `msgs' and compare them to the date/time specified. If -after is given, then only those messages whose "Date:" field value is chronologically after the date specified will be considered. The -before switch specifies the complimentary action. Both the -after and -before switches take legal 822-style date specifications as arguments. Pick will default certain missing fields so that the entire date need not be specified. These fields are (in order of defaulting): timezone, time and timezone, date, date and time- zone. All defaults are taken from the current date, time, and timezone. In addition to 822-style dates, pick will also recognize any of the days of the week ("sunday", "monday", and so on), and the special dates "today", "yesterday" (24 hours ago), and "tomorrow" (24 hours from now). All days of the week are judged to refer to a day in the past (e.g., telling pick "saturday" on a "tuesday" means "last saturday" not "this saturday"). Finally, in addition to these special specifications, pick will also honor a specification of the form "-dd", which means "dd days ago". Pick supports complex boolean operations on the searching primitives with the -and, -or, -not, and -lbrace ... -rbrace switches. For example, pick -after yesterday -and -lbrace -from freida -or -from fear -rbrace identifies messages recently sent by "frieda" or "fear". The matching primitives take precedence over the -not switch, which in turn takes precedence over -and which in turn takes precedence over -or. To override the default precedence, the -lbrace and -rbrace switches are provided, which act just like opening and closing parenthe- ses in logical expressions. If no search criteria are given, all the messages specified on the command line are selected (this defaults to "all"). Once the search has been performed, if the -list switch is given, the message numbers of the selected messages are written to the standard output separated by newlines. This is extremely useful for quickly generating arguments for other nmh programs by using the "backquoting" syntax of the shell. For example, the command scan `pick +todo -after "31 Mar 83 0123 PST"` says to scan those messages in the indicated folder which meet the appropriate criterion. Note that since pick's context changes are writ- ten out prior to scan's invocation, you need not give the folder argument to scan as well. The -sequence name switch may be given once for each sequence the user wishes to define. For each sequence named, that sequence will be defined to mean exactly those messages selected by pick. For example, pick -from frated -seq fred defines a new message sequence for the current folder called "fred" which contains exactly those messages that were selected. By default, pick will zero the sequence before adding it. This action can be disabled with the -nozero switch, which means that the mes- sages selected by pick will be added to the sequence, if it already exists, and any messages already a part of that sequence will remain so. The -public and -nopublic switches are used by pick in the same way mark uses them. FILES
$HOME/.mh_profile The user profile PROFILE COMPONENTS
Path: To determine the user's nmh directory Current-Folder: To find the default current folder SEE ALSO
mark(1) DEFAULTS
`+folder' defaults to the current folder `msgs' defaults to all `-datefield date' `-zero' `-list' is the default if no `-sequence', `-nolist' otherwise CONTEXT
If a folder is given, it will become the current folder. HISTORY
In previous versions of MH, the pick command would show, scan, or refile the selected messages. This was rather "inverted logic" from the UNIX point of view, so pick was changed to define sequences and output those sequences. Hence, pick can be used to generate the arguments for all other MH commands, instead of giving pick endless switches for invoking those commands itself. Also, previous versions of pick balked if you didn't specify a search string or a date/time constraint. The current version does not, and merely matches the messages you specify. This lets you type something like: show `pick last:20 -seq fear` instead of typing mark -add -nozero -seq fear last:20 show fear Finally, timezones used to be ignored when comparing dates: they aren't any more. HELPFUL HINTS
Use "pick sequence -list" to enumerate the messages in a sequence (such as for use by a shell script). BUGS
The argument to the -after and -before switches must be interpreted as a single token by the shell that invokes pick. Therefore, one must usually place the argument to this switch inside quotes. Furthermore, any occurrence of -datefield must occur prior to the -after or -before switch it applies to. If pick is used in a back-quoted operation, such as scan `pick -from jones` and pick selects no messages (e.g., no messages are from "jones"), then the shell will still run the outer command (e.g., scan). Since no messages were matched, pick produced no output, and the argument given to the outer command as a result of backquoting pick is empty. In the case of nmh programs, the outer command now acts as if the default `msg' or `msgs' should be used (e.g., "all" in the case of scan). To prevent this unexpected behavior, if -list was given, and if its standard output is not a tty, then pick outputs the illegal message number "0" when it fails. This lets the outer command fail gracefully as well. The pattern syntax "[l-r]" is not supported; each letter to be matched must be included within the square brackets. MH.6.8 11 June 2012 PICK(1)
All times are GMT -4. The time now is 09:25 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy