One line in a control file looks like this:
So using space as a delimiter, I am cutting and assigning the filename alone to a variable like below:
echo "$line" | cut -d " " -f2
and then I use sed: sed -i 1d "$targetDir"/"$file"
but in the log I am getting the below error: I did an echo as well to confirm if the file exists. As you can see, the file exists. but sed says no such file or directory.
- echo '/u/applic/data/hdfs1/etl_grmacw/ACDW/source/ZA/ZA_BKPF_20170725103534.txt exists' /u/applic/data/hdfs1/etl_grmacw/ACDW/source/ZA/ZA_BKPF_20170725103534.txt exists
- sed -i 1d $'/u/applic/data/hdfs1/etl_grmacw/ACDW/source/ZA/ZA_BKPF_20170725103534.txt\r' sed: can't read /u/applic/data/hdfs1/etl_grmacw/ACDW/source/ZA/ZA_BKPF_20170725103534.txt: No such file or directory
Is someone familiar with the $'string\r'. why is this happening to my variables. Is that the problem or something else? Can someone help me pls ! Thanks, Hari G