Cp command in execute command stage

A forum for discussing DataStage<sup>®</sup> basics. If you're not sure where your question goes, start here.

Moderators: chulett, rschirm, roy

Post Reply
SwathiCh
Premium Member
Premium Member
Posts: 64
Joined: Mon Feb 08, 2010 7:17 pm

Cp command in execute command stage

Post by SwathiCh »

Hi,

Iam trying to copy latest file in a directory to the other using the below command .My DirPath1 may also contain subdirectory, so i used grep .

cp `ls -ltr #$DirPath1 | grep ^- | tail -1 | awk '{print $9}'` #$dirPath2#/.

This command works fine in putty but donot in datstage.

In the log i could see the below error message
Output from command ====>
cp: omitting directory `DirPath1'
cp: cannot stat `xyz.CSV': No such file or directory.

So ,can anyone help me out how to use this in execute comman stage.
--
Swathi Ch
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

You may need to "escape" the single-quote characters.
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
premupdate
Participant
Posts: 47
Joined: Thu Oct 04, 2007 3:37 am
Location: chennai

Post by premupdate »


cp `ls -ltr #$DirPath1 | grep ^- | tail -1 | awk '{print $9}'` #$dirPath2#/

$DirPath1 is missing the right # symbol.
Cheers,
prem
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

Put the cp into the Command field and everything else into the Parameters field. Job parameters can not be resolved in the Command field.
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
Post Reply