aspose file tools*
The moose likes Linux / UNIX and the fly likes Adding a variable value to the text file Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Engineering » Linux / UNIX
Bookmark "Adding a variable value to the text file" Watch "Adding a variable value to the text file" New topic
Author

Adding a variable value to the text file

Pavan Math
Greenhorn

Joined: Jul 09, 2013
Posts: 1
Hi,

New to shell scripting.
I have a .txt file with values

1,abc,123,
2,xyz,456,

My requirement is to pick a column value from database and add it to the .txt file values

say 1,abc,123,sh1-123,
2,xyz,456,sh1-123,

Right now I am using
sed 's/"$l_shipment_number",/' <file_name>

where l_shipment_number=`sqlplus -s $FCP_LOGIN <<!!
SET head off
SET feed off
SET term off
SELECT DISTINCT shipment_number
FROM table
WHERE processed_file_name = <>
EXIT;
!!`

Now, I am not getting the value as needed in such a case.
Can you please let me know what the issue here is ?
Ivan Jozsef Balazs
Rancher

Joined: May 22, 2012
Posts: 867
    
    5
sed 's/"$l_shipment_number",/'

The sed program seems broken?: there is no closing /
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: Adding a variable value to the text file