Page 1 of 1

stripping tmestamp from files in a directory

Posted: Mon Jul 23, 2007 9:35 am
by edward_m
Hi All,

Application area sends all their files with timestamp in staging area and the files includes header and trailer records.Once the files landed in staging area i want to copy those files into seperate directory with stripping timestamp from file and also remove header,trailer records from those renamed files ..
Could anybody please throw some light on the above requirement..
Thanks in advance..

Posted: Mon Jul 23, 2007 11:26 pm
by ray.wurlod
This is much easier to do with a shell script than with DataStage. DataStage is a row mover rather than a file mover. Of course, DataStage can control when the script is executed. So can a third party scheduler.

It's not possible to provide a solution, because we have no idea of how the filenames-with-timestamps actually appear - for example is there a separator character?

Posted: Tue Jul 24, 2007 8:21 am
by edward_m
Ray,

If i am not asking too much then could you please disable premium flag on your response..

Thanks in advance..

Posted: Tue Jul 24, 2007 8:41 am
by chulett
Edward, you are a Charter Premium Member and so should be able to see the entire contents of Ray's post. :?

Posted: Tue Jul 24, 2007 9:07 am
by edward_m
chulett wrote:Edward, you are a Charter Premium Member and so should be able to see the entire contents of Ray's post. :? ...
No i am not able to see Ray's response..when i click on premium content buttom its going to premium content/premium membership page for registration..please help me on this.

Posted: Tue Jul 24, 2007 9:18 am
by chulett
I can't. You'd need to use the 'Contact' option at the top of the screen to send a message to the Webmaster as they are the only ones that can straighten this out for you if something is borked about your account.

Did your membership expire perhaps?

Posted: Wed Jul 25, 2007 11:20 am
by edward_m
Did your membership expire perhaps?
Yes..i renewed my premium membership and now i am able to see premium content. Somehow i never got an email from DCS strtegies regarding my membership expiration..it seems they don't need money i guess :lol:
Thanks again Craig..

Posted: Wed Jul 25, 2007 11:28 am
by edward_m
ray.wurlod wrote:This is much easier to do with a shell script than with DataStage. DataStage is a row mover rather than a file mover. Of course, DataStage can control when the script is executed. So can a third party scheduler.

It's not possible to provide a solution, because we have no idea of how the filenames-with-timestamps actually appear - for example is there a separator character?
Thanks Ray.Here is the detialed explanation..
All the files ended with _timestamp.txt i.e file_20070725_011215.txt while copying these files from input directory to output directories i want to do the following:
1) change the input file name file_20070725_011215.txt to file.txt and remove header and trailer from that file.txt
I would appreciate if you give solution..

make use of UNIX functionality

Posted: Wed Jul 25, 2007 12:34 pm
by Sudhindra_ps
hi Edward,

I would suggest you to write a shell script to carry out this activity. Do the following steps using shell script
1) make use of "awk" functionality so that you can break file name in to different pieces based on "_" as the delimiter.
2) Then make use of "mv" command to rename the file to <name>.txt

Once you are done with writing shell script code then you can call them in the "Execute command Stage" in the sequencer or you can execute by caling them in the "Before Job Subroutine".

Thanks & regards
Sudhindra P S