I'm in the unfortunate position that I have to work with Windows and Linux systems using MATLAB. For my MATLAB program I have config-files that contain the pathes to the corresponding data, etc. Now to switch from Windows to Linux and back, I'm trying to write a script that replaces the paths for the datasets. It is supposed to this recursivley for all configs contained in the 'data_analysis' directory.
Now it does work replacing simple strings (i.e.: for a simple variable), but with Windows- and Linux-paths it doesn't which has to do with the '\', ':', etc.
I call the script in the following form:
>> replace_string.sh C:\data_analysis /media/eclipse_ti/data_analysis/ /media/eclipse_ti/data_analysis/
where the 1. argument is the string to replace, 2. the string that will be put, 3. where to replace it.
I hope somebody can help me out and perhaps help me create a script that's as robust as possible.
Thanks in advance,
if [ $# -eq 4 ]
fileList=`grep --include=$includedFiles -RHl $stringToReplace $directory`
# echo "grep --include=$includedFiles -RHl $stringToReplace $directory"
if [ $# -eq 3 ]
fileList=`grep -RHl $stringToReplace $directory`
# echo "grep -RHl $stringToReplace $directory"
for file in $fileList
echo "Processing $file"
sed --in-place="_StringReplacementBKP$currentDate" "s|$stringToReplace|$replacementString|g" $file