stripping tmestamp from files in a directory
Moderators: chulett, rschirm, roy
stripping tmestamp from files in a directory
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..
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..
-
- Participant
- Posts: 54607
- Joined: Wed Oct 23, 2002 10:52 pm
- Location: Sydney, Australia
- Contact:
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?
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.
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
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?
Did your membership expire perhaps?
-craig
"You can never have too many knives" -- Logan Nine Fingers
"You can never have too many knives" -- Logan Nine Fingers
Thanks Ray.Here is the detialed explanation..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?
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..
-
- Participant
- Posts: 45
- Joined: Thu Aug 31, 2006 3:13 am
- Location: Bangalore
make use of UNIX functionality
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
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