stripping tmestamp from files in a directory

Post questions here relative to DataStage Enterprise/PX Edition for such areas as Parallel job design, Parallel datasets, BuildOps, Wrappers, etc.

Moderators: chulett, rschirm, roy

Post Reply
edward_m
Charter Member
Charter Member
Posts: 257
Joined: Fri Jun 24, 2005 9:34 am
Location: Philadelphia,PA

stripping tmestamp from files in a directory

Post 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..
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post 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?
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
edward_m
Charter Member
Charter Member
Posts: 257
Joined: Fri Jun 24, 2005 9:34 am
Location: Philadelphia,PA

Post by edward_m »

Ray,

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

Thanks in advance..
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

Edward, you are a Charter Premium Member and so should be able to see the entire contents of Ray's post. :?
-craig

"You can never have too many knives" -- Logan Nine Fingers
edward_m
Charter Member
Charter Member
Posts: 257
Joined: Fri Jun 24, 2005 9:34 am
Location: Philadelphia,PA

Post 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.
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post 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?
-craig

"You can never have too many knives" -- Logan Nine Fingers
edward_m
Charter Member
Charter Member
Posts: 257
Joined: Fri Jun 24, 2005 9:34 am
Location: Philadelphia,PA

Post 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..
edward_m
Charter Member
Charter Member
Posts: 257
Joined: Fri Jun 24, 2005 9:34 am
Location: Philadelphia,PA

Post 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..
Sudhindra_ps
Participant
Posts: 45
Joined: Thu Aug 31, 2006 3:13 am
Location: Bangalore

make use of UNIX functionality

Post 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
Post Reply