SAS_learner
SAS_learner

Reputation: 521

Trying to use X command to run UNIX commands from SAS EG

Here are the steps I followed .... 1)Created a shell script /fbrms01/dev/projects/Err_check.sh with following code in it....

Y=`date +'%Y'`
  M=`date +'%m'`
  D=`date +'%d'`
  today=$Y.$M.$D
  echo $today
  ls -l /fbrms01/dev/projects/tadis003/*_"$today"*.log | xargs grep "ERROR:" >         /fbrms01/dev/projects/tadis003/log_error.dat

2)Ran shell script on UNIX and it worked fine and created .dat file with exactly what I need.

$sh Err_check.sh

3)Ran that shell script on SAS using X command...Tried both

X '/fbrms01/dev/projects/tadis003/sh Err_check.sh';
  X 'sh Err_check.sh';

But it is not creating the .dat file.... Any idea where I'm doing mistake.... Thanks, Sam.

Upvotes: 0

Views: 5718

Answers (1)

SAS_learner
SAS_learner

Reputation: 521

/*STEP1:Created a .sh file with following code on unix 
    Y=`date +'%Y'`
    M=`date +'%m'`
    D=`date +'%d'`
    today=$Y.$M.$D
    ls -1 /fbrms01/dev/Logs/JB_*_"$today"_*.log | xargs grep -l "ERROR:" >> /fbrms01/dev/projects/tadis003/log_error.dat*/

/*STEP2:Run the shell script using X command*/
X 'sh /fbrms01/dev/projects/tadis003/log_error.sh';

Upvotes: 1

Related Questions