Nazrul10
asked on
Grep >> Column Heading
Hello,
I am using following code to split data into a .txt file based on userid(another text file). I need to insert column heading into each .csv file that I am creating in each loop. How can I insert column heading in this case
while read userid
do
NEWFILE=${SIFFILEDIR}/${us erid}.csv
#echo Processing $userid
grep $userid $BCPFILE >> "$NEWFILE"
done < "$BCPUSERID"
Your help will be appreciate
Nazrul
fc-hist-Master-Account.sh
I am using following code to split data into a .txt file based on userid(another text file). I need to insert column heading into each .csv file that I am creating in each loop. How can I insert column heading in this case
while read userid
do
NEWFILE=${SIFFILEDIR}/${us
#echo Processing $userid
grep $userid $BCPFILE >> "$NEWFILE"
done < "$BCPUSERID"
Your help will be appreciate
Nazrul
fc-hist-Master-Account.sh
ASKER
Hello
it is a sybase question. I am transfering my sybase table data to fc_hist_Master_Account.txt . There are lots of column in this .txt file. userid is one of the column in this text file.
BCPFILE=fc_hist_Master_Acc ount.txt
I have another .txt file named userid.txt that has only userid in a single column. I am reading userid from this .txt file and searching this userid into fc_hist_Master_Account.txt and inserting into seveeral .csv file based on userid I am passing from userid.txt file.
I attached the file.
NEWFILE=userid.txt
I am trying to insert column heading in each .csv file when I am inserting data from fc_hist_Master_Account.txt . So that when people open the .csv file they can understand what type of data in each column
Thanks
Nazrul
it is a sybase question. I am transfering my sybase table data to fc_hist_Master_Account.txt
BCPFILE=fc_hist_Master_Acc
I have another .txt file named userid.txt that has only userid in a single column. I am reading userid from this .txt file and searching this userid into fc_hist_Master_Account.txt
I attached the file.
NEWFILE=userid.txt
I am trying to insert column heading in each .csv file when I am inserting data from fc_hist_Master_Account.txt
Thanks
Nazrul
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Answer should be
echo "AccountCode,IECode,UserID ,TotalFeeA mount,Tota lTaxAmount ,IEPayoutA mount" >> $NEWFILE
echo "AccountCode,IECode,UserID
Your questions is unclear to me. Is it sybase question ?
I think you need to ask this in the Unix section.