Sponsored Content
Full Discussion: Read file name based on date
Contact Us Post Here to Contact Site Administrators and Moderators Read file name based on date Post 302979744 by RudiC on Thursday 18th of August 2016 11:48:41 AM
Old 08-18-2016
Some comments (not necessarily in severity order or order of appearance):
- consider refraining from using variables named close to PATH (essential system variable for your session; used to locate commands!) so you don't mess up your session by accident.
- your first ACTION_TIME assignment has a syntax error in the date command.
- giving variables (date) identical names to commands may lead to confusion.
- what do you create the date variable for in the first place?
- consider using the recommended $(...) notation in lieu of the deprecated `...` for "command substitution".
- your find command won't find any of the files quoted in post#1 as the pattern in SUFFIX_ARG doesn't match.
- the test for existence is for a different file than the one actually copied, so probably pointless.

On top, the specification in post#1 is sparse by itself, and it is not improved by your second post. Why don't you take a step back, start over, and present your problem in a decent, precise, detailed way supported by samples?

Last edited by RudiC; 08-18-2016 at 01:43 PM..
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Read file based on condition

Hi Friends, Can any one help with this: I have a huge file with the format as A SAM 4637 B DEPT1 4758 MILAN A SMITH 46585 B DEPT2 5385 HARRYIS B SAMUL 63547 GEORGE B DANIEL 899 BOISE A FRES 736 74638 I have to read this file and write only the records that starts with "B" only ... (5 Replies)
Discussion started by: sbasetty
5 Replies

2. Shell Programming and Scripting

Read a date value from other file.

My Situation is I have to read a date value from previuosly created file and need to increment the date in the newly created file. I need unix scripting for the above condtion. Thanx in advance. (3 Replies)
Discussion started by: chilli_taste
3 Replies

3. Shell Programming and Scripting

Split the file based on date value

Hi frnds, I have flat file as . Say : output-file1.txt Output-file2.txt (1 Reply)
Discussion started by: Gopal_Engg
1 Replies

4. UNIX for Dummies Questions & Answers

Truncating file based on date

Hi, I need to truncate a file based on date.Suppose i have a log file which is getting updated every date,i need to keep 7 days worth of data(like sysdate-7) and rest i want to truncate it.Can some help me? (5 Replies)
Discussion started by: Param0073
5 Replies

5. Shell Programming and Scripting

creating a file name based on date

I need to automate a weekly process of piping a directory list to a csv file. Normally I do ls -l > files_04182010.csv (04182010 being the date..) Can someome show me how I would script this, so that when the script is ran it grabs the current date and formats it and allows me to use that... (8 Replies)
Discussion started by: jeffs42885
8 Replies

6. Shell Programming and Scripting

Help with ksh-to read ip file & append lines to another file based on pattern match

Hi, I need help with this- input.txt : L B white X Y white A B brown M Y black Read this input file and if 3rd column is "white", then add specific lines to another file insert.txt. If 3rd column is brown, add different set of lines to insert.txt, and so on. For example, the given... (6 Replies)
Discussion started by: prashob123
6 Replies

7. Shell Programming and Scripting

Script to determine Date,TotalFile,total size of file based on date

I have file listed like below -rw-r--r--+ 1 test test 17M Nov 26 14:43 test1.gz -rw-r--r--+ 1 test test 0 Nov 26 14:44 test2.gz -rw-r--r--+ 1 test test 0 Nov 27 10:41 test3.gz -rw-r--r--+ 1 test test 244K Nov 27 10:41 test4.gz -rw-r--r--+ 1 test test 17M Nov 27 10:41 test5.gz I... (5 Replies)
Discussion started by: krish2014
5 Replies

8. HP-UX

HP/UX command to pull file name/date based on date

HI, Can anyone tell me how to pull the date and file name separated by a space using the find command or any other command. I want to look through several directories and based on a date timeframe (find -mtime -7), output the file name (without the path) and the date(in format mmddyyyy) to a... (2 Replies)
Discussion started by: lnemitz
2 Replies

9. Shell Programming and Scripting

To take file based on date passed

Hi Guys, I have certain files in my directory which gets appended with dates something like this T1_aug17.txt T1_Aug17.txt T1_Sep17.txt config.txt T1 T2 my code: curr_date=`date -d "$date" +%Y-%m-%d` path=mydir for file in `cat config.txt` do final_file=$(ls $path/ | grep -i... (12 Replies)
Discussion started by: rohit_shinez
12 Replies

10. UNIX for Beginners Questions & Answers

Read a file and send mail based on grep

Hi All, I am having a job and I need to send email when the job is running. On any other case (success,fail) I don't needed to send email. I check with BMC they told they dont have that in the version I am using. So I created a dependent job and grepped for the status and sent email. My... (1 Reply)
Discussion started by: arunkumar_mca
1 Replies
IKC(3pm)						User Contributed Perl Documentation						  IKC(3pm)

NAME
POE::Component::IKC -- POE Inter-Kernel Communication SYNOPSIS
IKC server use POE::Component::IKC::Server; # create all your sessions POE::Component::IKC::Server->spawn( port=>30, name=>'Server' ); # more options are available $poe_kernel->run(); IKC client use POE::Component::IKC::Client; POE::Component::IKC::Client->spawn( host=>name, port=>30, name=>'Client', on_connect=>&build); $poe_kernel->run(); sub build { # create sessions that depend on the foreign kernel. } Post a state on a foreign kernel $kernel->post('IKC', 'post', "poe://Server/session/state", $ONE_arg); The IKC is peer-to-peer. Server can post to client. $kernel->post('IKC', 'post', 'poe://Client/session/state', $ONE_arg); Call a state on a remote kernel Call semantics are impossible, because they would cause POE to block. IKC call is a bit different. It is a 'post', but with an extra RSVP parameter. $kernel->post('IKC', 'call', 'poe://Server/hello/world', $ONE_arg, 'poe:callback'); This will cause the returned value of the foreign state to be sent to state 'callback' in the current session. You may want the callback to be in another session, but I don't think this is a good idea. $kernel->post('IKC', 'call', 'poe://Server/hello/world', $ONE_arg, 'poe:/elsewhere/hi'); Note : if you use ->call('IKC'), it will return the number of foreign kernels the state was sent to. This is a handy way to find out if you are still connected to a foreign kernel. A little magic If a state is posted by a foreign kernel, $_[SENDER] is only valid during that state. However, you will be able to post back to it. $kernel->post($_[SENDER], 'something', 'the answer is foo'); The remote caller MUST have published states for them to be callable, eh? Publish / Subscribe You must publish a session's interface for it to be available to remote kernels. If you subscribe to a remote session, you may access it as if it was a local session. First, a session publishes its interfaces: $kernel->post('IKC', 'publish', 'session_alias', [qw(state1 state2 state3 state4)], ); Then a foreign kernel subscribes to it: # Look for a session on all known foreign kernels $kernel->post('IKC', 'subscribe', [qw(poe://*/session_alias/)]); # Look for a session on a specific foreign kernel $kernel->post('IKC', 'subscribe', [qw(poe://Pulse/timeserver)]); # Make sure the session has a given state $kernel->post('IKC', 'subscribe', [qw(poe://*/timeserver/connect)]); After subscription, a proxy session is created that can be accessed like any old session, though ->call() acts the same as ->post() for obvious reasons: $kernel->post('poe:/Pulse/timeserver', 'state', $arg1, $arg2...); Currently, the session alias used by post to the proxy session must be the same one as used when subscribing. Because kernels have multiple names, if you are using '*' as the kernel name when subscribing, the session alias might not be what you think it is. See "Monitor" for details. Of course, attempting to post to a proxy session before it is created will be problematic. To be alerted when the proxy session is created, a callback state may be specified, $kernel->post('IKC', 'subscribe', [qw(poe://*/timeserver)], 'timeserver_subscribed'); The callback will be called with a list of all the sessions that it managed to subscribe to. You should check this list before continuing. Better yet, you could use the IKC monitor (see below). One can also let POE::Component::IKC::Client->spawn deal with all the details. POE::Component::IKC::Client->spawn( port=>31337, name=>$name, subscribe=>[qw(poe://*/timeserver)], on_connect=>&create_me, ); 'on_connect' is only called when all the subscriptions have either been accepted. If a subscription was refused, create_ikc_client will give up. If multiple foreign kernels where quieried for a session (as is the case above), subscription is deemed to succeed if at least one foreign kernel accepts the subscription. To undo things : $kernel->post(IKC=>'retract', 'session_alias'=>[qw(states)]); $kernel->post(IKC=>'unsubscribe', [qw(poe://Pulse/timeserver)]); Monitor Say you wanted to monitor all remote kernels that connect to you: $kernel->post(IKC=>'monitor', '*'=>{register=>'some_event'}); sub some_event { my($name, $real)=@_[ARG1, ARG2]; print "- Remote kernel ", ($real ? '' : "alias "), "$name connected "; } Later, you want to know when a given remote session disconnects: $kernel->post(IKC=>'monitor', some_kernel=>{unregister=>'bye_bye'}); Or maybe you think a session should clean up and leave whenever IKC does. $kernel->post(IKC=>'monitor', '*'=>{shutdown=>'other_event'}); sub other_event { # kill wheels, alarms, selects and aliases here } See "monitor" in POE::Component::IKC::Responder for more details. Shutdown When you feel the time is right and you want to get rid of all IKC-related sessions, just do the following: $kernel->post(IKC=>'shutdown'); And they should all disapear. At worst, some will still have registered alises, but this won't prevent the kernel from exiting. The local kernel You can post to the local kernel as if it was remote: $kernel->post(IKC=>'post', "poe://$kernel->ID/session/state'=>$ONE_arg); However, you can't currently subscribe to local sessions. I don't know how I'm going to resolve this. DESCRIPTION
This is Inter-Kernel Communication for POE. It is used to get events from one POE kernel to another SEE ALSO
POE::Component::IKC::Responder -- Heart of the system POE::Component::IKC::Server -- Create a process that listens for other kernels. POE::Component::IKC::Client -- Create a process that connects to other kernels. POE::Component::IKC::ClientLite -- Light weight IKC implementation for places you can't use POE, such as mod_perl. POE::Component::IKC::Channel -- Handle communcation with other kernels. POE::Component::IKC::Proxy -- Proxy session that is created when you subscribe to a remote session. POE::Component::IKC::Freezer -- Pure-Perl serialization method. POE::Component::IKC::Specifier -- Helper routines for parsing IKC specifiers. AUTHOR
Philip Gwyn <perl-ikc at pied.nu> COPYRIGHT AND LICENSE
Copyright 1999-2011 by Philip Gwyn. All rights reserved. This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself. See <http://www.perl.com/language/misc/Artistic.html> perl v5.12.4 2011-08-27 IKC(3pm)
All times are GMT -4. The time now is 12:40 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy