Published on :
Administration CREATION_INTERNE

Text Search by Unix System Command

This code is also available in: Deutsch Español Français
Awaiting validation
Attention : This code requires administrator privileges.
This script uses system commands (X command and PIPE) to navigate a specific server directory and perform a recursive search (grep) for the string 'AAShare.AAEXTRACTICIS'. The command results are captured and imported into the SAS© table 'sasjobs'.
Data Analysis

Type : CREATION_INTERNE


Data is dynamically generated by executing a Unix system command (grep) via a 'filename pipe'.

1 Code Block
SYSTEM COMMAND
Explanation :
Changes the current operating system working directory to a specific path and displays an empty line.
Copied!
1x "cd /c01/sasdata/analytics/infm/divisional/aa/aaprod";
2x "echo";
3 
2 Code Block
DATA STEP Data
Explanation :
Defines a 'pipe' type fileref to execute the 'grep' command and captures its standard output. The Data step then reads this stream to create the 'sasjobs' table containing the found lines.
Copied!
1filename ps_list pipe "grep -r 'AAShare.AAEXTRACTICIS'";
2DATA sasjobs;
3 INFILE ps_list;
4 LENGTH process $ 180.;
5 INPUT process $ char180.;
6RUN;
This material is provided "as is" by We Are Cas. There are no warranties, expressed or implied, as to merchantability or fitness for a particular purpose regarding the materials or code contained herein. We Are Cas is not responsible for errors in this material as it now exists or will exist, nor does We Are Cas provide technical support for it.