Hey guys,
I know that title is a mouthful - I'll try to better explain my struggles a little better...
What I'm trying to do is:
- Query a db and output to a file, a list of column data.
- Then, for each line in this file, repeat these values but wrap them with:
ITEM{
LABEL = <LINEVALUEFROMFILE>
VALUE = <LINEVALUEFROMFILE>
}
for each line in the file. I'm doing this and outputting that to a new file, and purging the old.
3. CAT the contents of the formatted output file, then substitute it into a .cfg file in place of a "Marker" or string value that is unique (in my case, a string called VENDORLIST.
I have everything working fine right up to the sed statement. I've tried using:
sed -i "s/$marker/$markerrepl/g" $formattedfile
but that returns:
sed: -e expression #1, char 60: unterminated `s' command
I've tried "protecting" the variables by single quoting them like this:
sed -i "s/'$marker'/'$markerrepl'/g" $formattedfile
but that returns a similiar error with a different character reported, and if I wrap the variables in "" it merely substitutes the marker string with the variable in double quotes (not the content of the variable).
Speaking of the variable content, at the end of the script I echo it out to screen so I know the content is there... all I can figure is there is an issue with characters within that variable and that's the problem...
By the way, here's an example of what that variable content looks like from the formatted file (step 2):
ITEM{
LABEL = Panasonic Corporation of N.A.
VALUE = Panasonic Corporation of N.A.
}
ITEM{
LABEL = NewWave Technologies, Inc.
VALUE = NewWave Technologies, Inc.
}
ITEM{
LABEL = Kyocera Doc Solutions of America, Inc.
VALUE = Kyocera Doc Solutions of America, Inc.
}
ITEM{
LABEL = Ingram Micro, Inc.
VALUE = Ingram Micro, Inc.
}
Are there any sed or awk experts out there can help me get this data substituted in for my marker string?