Skip to Content
author's profile photo Former Member
Former Member

Calling UNIX commands in BODS SCRIPT

Hi,

I have a scenario, where I have the input in Filename.txt

S|ABC|GB

S|ABC|TS

Output should be like

'GB','TS'

So,I written following UNIX command to get the above output;

grep "S|ABC" Filename.txt | cut -d'|' -f3 | xargs | sed "s/[^ ][^ ]*/'&',/g" | sed 's/,$//'

I want to call the above command in BODS SCRIPT. Is it can be accomplished?

Kindly show me some light on it.

Thanks

Add comment
10|10000 characters needed characters exceeded

2 Answers

  • Best Answer
    Posted on Dec 21, 2015 at 02:12 PM

    Data Services cannot send commands to Unix OS but it can only send to Database tables.

    Add comment
    10|10000 characters needed characters exceeded

  • Posted on Dec 22, 2015 at 07:15 AM

    Just put your command in the script file

    grep "S|ABC" /usr/folder_name/Filename.txt | cut -d'|' -f3 | xargs | sed "s/[^ ][^ ]*/'&',/g" | sed 's/,$//'

    First of all the BODS user account which is running the job should have permissions to execute the script(bash or KSH script).

    Just took an example

    $File_Availability=exec('ksh','[$$Scriptfilepath]/Unix_file_check.ksh',8);

    where $$Scriptfilepath= absolute path to the script file

    Regards

    Arun Sasi

    Add comment
    10|10000 characters needed characters exceeded