Page 2 of 2

Posted: Wed Jan 03, 2007 5:38 am
by jhmckeever
For older versions of DS (where this functionality wasn't available) I use the following script. It takes a file pattern and echos all lines from all matching files with each line prefixed with the name of the source file:

Code: Select all

#! /usr/bin/ksh
#------------------------------------------------
# Usage: getFiles.ksh {FilePattern}
#------------------------------------------------

FilePattern="$1"
if [ "$FilePattern" = "" ]
   then echo "Must supply a file pattern"
   exit 1
fi

# Iterate over files matching the supplied pattern
while [ "$1" != "" ]
do
   # Get the filename
   SetName=`echo $1`

   # Iterate over each line of the file
   cat $1 |
   while read Job
   do
      echo "$SetName    $Job"
   done # read line (from file)

   shift

done # read Filenames
(It might look a little weird in places as I've stripped out some funtionality specific to our installation, but it should still work fine.)

HTH, :)
J.

Patch details for reading multiple files using file pattern

Posted: Thu Jun 24, 2010 12:54 am
by kksr
Hi ,

We are also facing similar issue while reading multiple files using file pattern option , but we are unable to find the mentioned patch (96576 for DS EE 7.5.1A ) in IBM web site .Please share the Patch/ fix details for this issue .

DS Versionn : 7.5.1A
OS : AIX


Thanks
Kiran

Posted: Thu Jun 24, 2010 5:30 am
by Sreenivasulu
Different approach ->
You can use the loop stage to the get the file name ?
1.Use Execute Command Activity to fire a shell command 'ls *.csv' (*.csv is the pattern)
2.Use loop stage with list
3.Use the UserVariable activity to get the file name

Regards
Sreeni

Re: Patch details for reading multiple files using file patt

Posted: Thu Jun 24, 2010 5:53 am
by chulett
kksr wrote:we are unable to find the mentioned patch (96576 for DS EE 7.5.1A ) in IBM web site. Please share the Patch/ fix details for this issue.
That would need to come from your official support provider.