on 12-21-2015 1:30 PM
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
Data Services cannot send commands to Unix OS but it can only send to Database tables.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Use exec built-in function.
From the SAP Data Services Reference Guide:
exec(<command_file, parameter_list, flag>)
with <command_file>:
A string that indicates the location and file name to execute. This string is relative to the Job Server location. It can be an absolute or relative path. The files and directories in the path must be accessible from the Job Server's computer.
The <command_file> can be a Windows batch file, a UNIX shell script, or a binary executable. To run other interpreted scripts, the <command_file> must be the name of the command interpreter (e.g., 'perl') and the script must be the first parameter in the <parameter_list> .
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
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
87 | |
10 | |
10 | |
10 | |
7 | |
6 | |
6 | |
5 | |
5 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.