Hi again, have a script that I would like run, but before I can run it I need to strip out the windows \r end of lines.
I have put the command into a text file and set the command to run every 10 seconds the coomand I use to do this is
while sleep 10; do /Volumes/AraxiVolume_HW07376_J/OPS_OutPuts_TimeStampText_For_Naming_Work_Folder/OPS_TempFolderForFiringTrigger/GOLDEN.TERM; done
The command that its firing is in a text file called GOLDEN.TERM
this is the code for that file
cr=$(printf "\r")
sed -i "" -e s"/$cr//g" /Volumes/AraxiVolume_HW07376_J/OPS_OutPuts_TimeStampText_For_Naming_Work_Folder/OPS_OutPuts_TimeStamp_SED_INPUT/[0-9]*-OPS_OutPuts_TimeStamp
/Volumes/AraxiVolume_HW07376_J/OPS_OutPuts_TimeStampText_For_Naming_Work_Folder/OPS_OutPuts_TimeStamp_SED_INPUT/[0-9]*-OPS_OutPuts_TimeStamp
That the command does is strips away the windows \r and save over the original file and then executes the original file with out windows \r.
What I would like to do is pipe the the output from the command that strips away the windows \r through to the shell again without saving the file to disk.
The commands I have work in the terminal put trying to execute as them from a file does not.
Does any one have an idea how I can make this work?
I was thinking maybe using pipe would work better if i run the file through tr or sed can I get the output to fire at the end of the pipe can you show me some examples?
Hi I don't necessarily want to overwrite the input file. The script thaty I want to run just needs the window \r end of lines taken out before it fires.
Is there any way I could pass the out put of the tr command that takes out the window \r end of lines with pipe directly to the shell so that it just runs the script?
Thanks very much for your help
Oh, you want to run the file directly after doing it?
You use the bash or sh command for that.
tr -d '\r' < windowstext | bash -s
Of course, it would be better to not edit your scripts in microsoft notepad. Editing your UNIX scripts in UNIX with a UNIX editor would avoid the non-UNIX carriage returns...
Thanks you very much for everyone on this board fot all your help with this project I have the files working the way they should now all your patience is very much appreciated
You guys are so awesome!
Hi I am trying to use this command inside a shell script that the to copy 3 files files to another directory
for i in ${/Volumes/AraxiVolume_HW07376_J/Jobs/OPS_IMPO_18x18_1-side/UserDefinedFolders/OPS_IMPO_18x18_1-Sided_Check}/*; do
[ $((N--)) = 0 ] && break
cp -t "${/Volumes/AraxiVolume_HW07376_J/Jobs/OPS_IMPO_18x18_1-side/UserDefinedFolders/OPS_IMPO_18x18_1-Sided_PreInput}" -- "$i"
done
I keep getting this error:
/Volumes/AraxiVolume_HW07376_J/Jobs/OPS_IMPO_18x18_1-side/UserDefinedFolders/moveit.TERM: line 5: ${/Volumes/AraxiVolume_HW07376_J/Jobs/OPS_IMPO_18x18_1-side/UserDefinedFolders/OPS_IMPO_18x18_1-Sided_Check}/*: bad substitution
---------- Post updated at 05:20 PM ---------- Previous update was at 05:06 PM ----------
Hi I am trying to use this command inside a shell script to copy the first 3 files from a directory that contains many
N=3;
for i in ${/Volumes/AraxiVolume_HW07376_J/Jobs/OPS_IMPO_18x18_1-side/UserDefinedFolders/OPS_IMPO_18x18_1-Sided_Check}/*; do
[ $((N--)) = 0 ] && break
cp -t "${/Volumes/AraxiVolume_HW07376_J/Jobs/OPS_IMPO_18x18_1-side/UserDefinedFolders/OPS_IMPO_18x18_1-Sided_PreInput}" -- "$i"
done
I keep getting this error
/Volumes/AraxiVolume_HW07376_J/Jobs/OPS_IMPO_18x18_1-side/UserDefinedFolders/moveit.TERM: line 5: ${/Volumes/AraxiVolume_HW07376_J/Jobs/OPS_IMPO_18x18_1-side/UserDefinedFolders/OPS_IMPO_18x18_1-Sided_Check}/*: bad substitution
Can any one tell me what I'm doing wrong?
Thanks again
ps. I accidentally posted this earlier by by hitting the submit button instead of preview, sorry if this caused any confusion.
/Volumes/AraxiVolume_HW07376_J/Jobs/OPS_IMPO_18x18_1-side/UserDefinedFolders/OPS_IMPO_18x18_1-Sided_Check seems like an unlikely name for a variable...