how to append a file using sed command
i have this file
test [z_jigneshb.WF:DS_aftab.ST:s_m_EDW_F_SOP_DMND_FCST_DTL_DS] $$INPUT_FILE_DATE=000000 $$PFFLAG=0 i am writing a script to change the value for the date and flag which it gets from a file in the same directory. the name of the file is DS_P_201202 i have the code working but when i redirect it to the test file, it becomes a blank file Code:
FILE_NAME=$(ls -tr DS_*|head -1) |
Quote:
The shell output redirection operator (>) will truncate/erase the file prior to the command being executed. Because the file has been truncated, there is no data for the sed command to read. You have two options: 1. Use the sed '-i' option to modify the file in-place. As in: Code:
sed -i '/^\$\$INPUT_FILE_DATE=/s/[0-9]\{6\}/'$DATEMONTH'/' test For option 2 to work, you still need to modify your sed commands. The easiest would be to specify multiple sed commands with the -e option. For instance: Code:
sed -e '/^\$\$INPUT_FILE_DATE=/s/[0-9]\{6\}/'$DATEMONTH'/' \ |
All times are GMT -5. The time now is 07:55 PM. |