Sponsored Content
Top Forums Shell Programming and Scripting script to find filenames with latest version and for all seq. numbers in a day Post 302393104 by Deepakbabu on Sunday 7th of February 2010 11:07:17 PM
Old 02-08-2010
script to find filenames with latest version and for all seq. numbers in a day

Hi,

We have a requirement to find the set of filenames from the group of files in a specified folder based on
(i) version number
(ii) sequence number
such that, for any given sequence number in a day only the latest version filenames have to indentified.
Below is the format of the file

<HUB>_<FEED_NAME>_<DATE>_<SEQUENCE_NUM>_<VERSION_NUM>.pgp

Hence if the folder has files namely
- dummy_feed_02022010_1_1.pgp
- dummy_feed_02022010_1_2.pgp
- dummy_feed_02022010_1_3.pgp
- dummy_feed_02022010_2_2.pgp
-dummy_feed_01022010_1_1.pgp

In the above case, if the shell script is run on 2 nd feb assuming, it should pick files for that day with all sequence numbers but only the latest versions.

here, the shell script should return

dummy_feed_02022010_1_3.pgp
dummy_feed_02022010_2_2.pgp

Please help me out how to get this done using a shell script. Let me know if you need more details.

Thanks
Deepak

Last edited by pludi; 02-08-2010 at 03:07 AM.. Reason: sanitized formatting
 

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

What is the latest version of Unix?

I want to buy it (2 Replies)
Discussion started by: LANSTARR.COM
2 Replies

2. Shell Programming and Scripting

Write a shell script to find whether the first day of the month is a working day

Hi , I am relatively new to unix... Can u pls help me out to find out if the first day of the month is a working day ie from (Monday to Friday)...using Date and If clause in Korn shell.. This is very urgent. Thanks for ur help... (7 Replies)
Discussion started by: phani
7 Replies

3. Shell Programming and Scripting

script to find latest executable in particular directory and start that particular ex

i have a directory in which there are executable files and these files are added at runtime. now i need a shell script which will be called at a certain interval. this shell script should find the latest executable file in that directory and start that executable. care should be taken that once the... (6 Replies)
Discussion started by: kvineeth
6 Replies

4. Shell Programming and Scripting

shell script to find latest date and time of the files

Hi everyone, Please help:) I have a list of 1000 different files which comes daily to the directory.Some of the files are not coming to the directory now. I need to write a shell script to find the latest date and time of the files they came to the directory. The files should be unique.... (1 Reply)
Discussion started by: karthicss
1 Replies

5. Shell Programming and Scripting

Script to find previous month last day minus one day timestamp

Hi All, I need to find the previous month last day minus one day, using shell script. Can you guys help me to do this. My Requirment is as below: Input for me will be 2000909(YYYYMM) I need the previous months last day minus 1 day timestamp. That is i need 2000908 months last day minus ... (3 Replies)
Discussion started by: girish.raos
3 Replies

6. Shell Programming and Scripting

Find out the day in Bash Shell script

Hello All, I need a bash shell script to find out a day from the date.For example we give the date(20100227/YYYYMMDD) then we get the day 'Saturday'. Thanks in advance, Satheesh (5 Replies)
Discussion started by: satheesh4093
5 Replies

7. Fedora

Script to find out first day of our calender

I try to find the first day of our calender. So I used this script ... echo -n "The week of the date 01jan0001 : " echo -n `date -d 00010101 +%A` echo But its shows error bash-3.1$ sh first_day.shThe week of the date 01jan0001 : date: invalid date `00010101' (3 Replies)
Discussion started by: krishnampkkm
3 Replies

8. Shell Programming and Scripting

Converting filenames from julian day to yyyy-mm-dd and retrieving weekly mean values

Hi, I need help to convert the filenames of my 9-year daily files (1999-2007) from a julian day to yyyy-mm-dd format. my original files are patterned likes the ones below. 1999001.txt 1999002.txt 1999003.txt 1999004.txt ... 1999365.txt desired output: 19990101.txt 19990102.txt... (3 Replies)
Discussion started by: ida1215
3 Replies

9. Shell Programming and Scripting

How to find the date of previous day in shell script?

Hi Experts, i am using the below code get the date of previous day. #!/usr/bin/ksh datestamp=`date '+%Y%m%d'` yest=$((datestamp -1)) echo $yest When i execute the code i am getting output as: 20130715 What i am trying here is, based on the date passed i am fetching previus day's... (0 Replies)
Discussion started by: learner24
0 Replies

10. Shell Programming and Scripting

awk command to find seq lines

I have a below file FILE.cfg JAN_01 VAR1=4 VAR2=SUM VAR3=PRIVATE JAN_10 VAR1=44 VAR2=GUN VAR3=NATUR JAN_20 VAR1=3 VAR2=TQN VAR3=COMMA code: (JAN_10 is argument passed from script) (6 Replies)
Discussion started by: Roozo
6 Replies
SENDFILE(1)						      General Commands Manual						       SENDFILE(1)

NAME
sendfile - send file(s) via Internet SYNOPSIS
sendfile [ -stMgduzvolSPiqQV ] [ -c=" comment" ] [ -C=program ] [ -ps=[my_ID] ] [ -pe=[to_user] ] [ -m LIMIT ] file [...] user[@host] sendfile -a="archive" [ -uviqQ ] [ -c=" comment" ] [ -C=program ] [ -ps[=my_ID] ] [ -pe[=to_user] ] file_or_directory [...] recipient DESCRIPTION
sendfile sends files to the specified recipient. On the receiving site there must be a SAFT-server (Simple Asynchronous File Transfer) installed like sendfiled which stores incoming files into the recipients spool-directory. SAFT knows about 4 file types: BINARY Byte-stream file which will not be modified. SOURCE Record oriented program source file. Only EOL will be translated. TEXT Human readable text files. EOL and the character set (like German umlauts) will be translated. MIME Multipurpose Internet Mail Extension file as defined by RFC 2045-2049. Files can be sent compressed or pgp-encrypted and/or pgp-signed. As an extension to SAFT, sendfile is able to send multiple binary files in one archive file. Default mode for sendfile is sending compressed binary files. Compression will be disabled for hosts which are inside your LAN and for files which cannot be compressed. With the helper program sfconf you can easily configure sendfile. ARGUMENTS
You have to specify at least one file name and the recipient's address. An address can be specified as: user a local user or a sendfile alias (see below), e.g.: framstag user@host an user on a remote host, e.g.: framstag@bofh.belwue.de saft://host/user like above, but in URL-syntax, e.g.: saft://bofh.belwue.de/framstag saft://host:port/user like above, but with alternate SAFT-port, e.g.: saft://bofh.belwue.de:4870/framstag OPTIONS
-4, -6 Explicitly force IPv4 or IPv6 connections. By default, the program will try to resolve the name given, and choose the appropriate protocol automatically. If resolving a host name returns both IPv4 and IPv6 addresses, sendfile will try to use the adresses in the order they are returned by the resolver. -s Send in source mode (not needed if sending to a unix host). -t Send in text mode (not needed if sending to a unix host). -M Send MIME file (must be external composed before!). -g Send in guessed mode: sendfile tries to guess the correct mode (source, text or binary). This will not work in every case and not on all platforms! -i Print more transaction information. -v Verbose mode: show SAFT protocol messages. -V Show version information and exit. -u Send uncompressed. -z Send compressed. -a Send files or whole directories as one archive (binary mode only). You have to specify an archive name. -d Delete previous sent file. No wildcards allowed. -o Overwrite already sent file(s) with same name. -P Read file from stdin. You must specify a file name, too. -S Spool file into outgoing queue for later processing. You must run a sendfiled which supports this mode. -l List files in the outgoing spool. -q Quiet mode 1: print no transfer messages. -Q Quiet mode 2: print no transfer, information or warning messages. -c Add a short comment to a single file. -C Force usage of specified compression program (gzip or bzip2). -pc Encrypt file(s) with pgp (IDEA symmetric). -pe Encrypt file(s) with pgp (public key). -ps Add pgp signature(s) to the file(s). -m Limit the maximum thruput (in KB/s). ARGUMENTS
user Recipient user name. Can be an alias, too. See below. file File name to be sent. Only when using the -a="archive" option you may specify any file or directory. EXAMPLES
sendfile -t project.txt chief@bigvax.somewhere.net sendfile -a=jokes -c 'from Gary Larson' *.gif framstag FILES
/etc/sendfile.deny Users which are not allowed to receive files or messages (set by root). /var/spool/sendfile/$USER/config/config Your configuration file. Valid entries are (the | symbol means " or"): bell = on|off add a bell when a file or message arrives. deleting = on|off allow remote users to delete their files after transmission msglog = on|off log incoming messages in /var/spool/sendfile/$USER/msglog notification = none|both|mail [user@host]|message [user@host] send a notification when a file has been arrived via mail or message or none or both mechanism. forward = user@host set a forward address. /var/spool/sendfile/$USER/config/restrictions List of addresses from where you don't want messages or files. The format is: user@host [mfb] m stands for messages, f for files and b for both. Wildcards * and ? are allowed. Examples: gates@microsoft.com b *aol.com m You may also specify the addresses in URL-syntax. /var/spool/sendfile/$USER/config/aliases The sendfile alias file. Format: alias address [sendfile-options] Example: chief grmblfz@bigvax.somewhere.net ccc chaoscomputerclub@saft.ccc.de -pe -ps You may also specify the addresses in URL-syntax. SEE ALSO
sfconf receive(1) sendmsg(1) fetchfile(1) AUTHOR
Ulli Horlacher - framstag@rus.uni-stuttgart.de 3rd Berkeley Distribution SENDFILE(1)
All times are GMT -4. The time now is 11:12 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy