The UNIX and Linux Forums  

Go Back   The UNIX and Linux Forums > Special Forums > UNIX and Linux Applications
.
google unix.com




View Single Post in the UNIX and Linux Forums - Click on the Thread or Permalink to View Entire Thread -->
  #3 (permalink)  
Old 06-17-2009
lkeswar lkeswar is offline
Registered User
  
 

Join Date: Jun 2009
Posts: 4
Need small help to write the code in unix

Hi,

I tried with the shell script but it is not loading into table for the below script

#!/bin/bash

#export custno=""

custno=$(awk -F"," '{print NR " " $3}' 'datafile.txt' | grep 1 | cut -d" " -f2)
sed 's/#x#/'$custno'/g' 'ctrl.ctl'

Below is the data file(datafile.txt)

sno,sNAME,35642,reactflag
1,KIRAN,KUMAR
2,SURESH,KUMAR
3,MADHU,VARIGONDA

Here is the control file(ctrl.ctl)
options(skip =1)
LOAD DATA
INFILE 'datafile.txt'
TRUNCATE INTO TABLE LOADER_TEST
FIELDS TERMINATED BY ','
TRAILING NULLCOLS (
sno Integer external,
sname char(50),
custno char(50) CONSTANT '#x#',
reactflag char(50)
)

Please help me in advance