my testfile is
aspsun1:usasp000$cat testfile
open connection
put $TMPDIR/SUNIA.PJ080202.ENGRPTBZ.<OPERATOR>.133 <FILENAME>
quit
my problem statement is to replace the line with put command with 2 different lines a cd command and then put line.
from
put $TMPDIR/SUNIA.PJ080202.ENGRPTBZ.<OPERATOR>.133 <FILENAME>
to
cd $TMPDIR
put SUNIA.PJ080202.ENGRPTBZ.<OPERATOR>.133 <FILENAME>
for this i have used 4 variables
$echo $line
put $TMPDIR/SUNIA.PJ080202.ENGRPTBZ.<OPERATOR>.133 <FILENAME>
$TO_DIR=`echo $line |awk -f" " '{print $2}' |awk -F"/" '{$NF=""; print $0}'|sed 's/ /\//g' `
FILE_NAME=`echo $line |awk -f" " '{print $2}' |awk -F"/" '{print $NF}' `
REM_PART=`echo $line |awk -f" " '{$1="";print $0}'|awk -f" " '{$1="";print $0}'`
$echo $TO_DIR
$TMPDIR/
$echo $FILE_NAME
SUNIA.PJ080202.ENGRPTBZ.<OPERATOR>.133
$echo $REM_PART
<FILENAME>
but whenever i execute my command it just do not work, may be because of the '/' sign.
$sed 's/$line/cd $TO_DIR put $FILE_NAME $REM_PART/' testfile
open connection
put $TMPDIR/SUNIA.PJ080202.ENGRPTBZ.<OPERATOR>.133 <FILENAME>
quit
Please help !!