hello, I am trying to use sed to replace lines in files but the line has spaces and seems to be giving me issues.
I want this line:
ALEPH_COPY 2
to become this line:
ALEPH_COPY 3
I have a conf file that fills in env variables and then I have a script that does the following:
I am also echo'ing the variables as well as the command to try and figure out what is going wrong:
Updating Aleph start files...
START_AC: ALEPH_COPY 2
DEST_AC: ALEPH_COPY 3
/usr/bin/sed 's/'ALEPH_COPY 2'/'ALEPH_COPY 3'/g' /aleph/prod/itx/alephe/aleph_start > /aleph/prod/itx/alephe/aleph_start.tmp
sed: Function s/ALEPH_COPY cannot be parsed.
When I change the conf file to this:
START_AC=ALEPH_COPY
DEST_AC=TEST
everythign goes fine, so I'm being forced to think it has seomthign to do with the spaces.
output:
Updating Aleph start files...
START_AC: ALEPH_COPY
DEST_AC: TEST
/usr/bin/sed 's/'ALEPH_COPY'/'TEST'/g' /aleph/prod/itx/alephe/aleph_start > /aleph/prod/itx/alephe/aleph_start.tmp
Any help would be greatly appreciated. Thanks in advance.
I want this line:
ALEPH_COPY 2
to become this line:
ALEPH_COPY 3
I have a conf file that fills in env variables and then I have a script that does the following:
Code:
echo "Updating Aleph start files..."
echo "START_AC: $START_AC"
echo "DEST_AC: $DEST_AC"
echo "$SED 's/'${START_AC}'/'${DEST_AC}'/g' $ALEPH_START > $ALEPH_START_TEMP"
$SED 's/'${START_AC}'/'${DEST_AC}'/g' $ALEPH_START > $ALEPH_START_TEMP
I am also echo'ing the variables as well as the command to try and figure out what is going wrong:
Updating Aleph start files...
START_AC: ALEPH_COPY 2
DEST_AC: ALEPH_COPY 3
/usr/bin/sed 's/'ALEPH_COPY 2'/'ALEPH_COPY 3'/g' /aleph/prod/itx/alephe/aleph_start > /aleph/prod/itx/alephe/aleph_start.tmp
sed: Function s/ALEPH_COPY cannot be parsed.
When I change the conf file to this:
START_AC=ALEPH_COPY
DEST_AC=TEST
everythign goes fine, so I'm being forced to think it has seomthign to do with the spaces.
output:
Updating Aleph start files...
START_AC: ALEPH_COPY
DEST_AC: TEST
/usr/bin/sed 's/'ALEPH_COPY'/'TEST'/g' /aleph/prod/itx/alephe/aleph_start > /aleph/prod/itx/alephe/aleph_start.tmp
Any help would be greatly appreciated. Thanks in advance.