View Single Post
  #10 (permalink)  
Old 11-20-09, 09:37
SeenuGuddu SeenuGuddu is offline
Registered User
 
Join Date: Sep 2009
Posts: 16
hi mike

here is the code but i have some problem with that

${COL_SIZE_DAT its a flat file of records of column size

Code:
	normalfile="john_789_has_2007-11-30_s"
	
    j=1
    export delim=""
    while read col_size_dat
    do 
        export col_size=$(echo "${col_size_dat}" | cut -f2 -d"|")
        export delim_temp="${delim} substr( $0,$j,$col_size) \"~\"" 
        j=`expr $j + ${col_size}`   
    done < ${COL_SIZE_DAT}
   
   export delim_temp1=$(echo "$delim_temp" | sed 's/\(.*\)"~"/\1/')   
   export delim_cmd=`echo " awk '{ print ${delim_temp1}; }' " ` 
   echo $delim_cmd
 
  cat normalfilename | $delim_cmd > delimatedfile
instead of normalfile="john_789_has_2007-11-30_s"
u want me to give normalfile for $0 or any other way we had the substr( $0,$j,$col_size)

wat should i use for redirecting the filewith delimated
is that ok

cat normalfilename | $delim_cmd > delimatedfile
and after running this
i am getting the error

awk: cmd. line:1: '{
awk: cmd. line:1: ^ invalid char ''' in expression

Last edited by SeenuGuddu; 11-23-09 at 00:32.
Reply With Quote