Would pipe work better with this command

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?

You have the file two times in the sed arguments, but in sed -i each file argument is input and output! Remove one of them, so sed runs once!

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?

You cannot overwrite your input file, is the thing.

tr 'a' 'b' < inputfile | sed 's/q/r/' | awk '...' > inputfile-out

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

tr -d '\r' < inputfile | sed '...' > outputfile

Yes. The shell (sh, ksh, bash, etc) will read its script from the pipe if it's not provided as a command line argument.

Regards,
Alister

Thats good to know because I don't really need to save these files I would just like to run them
if i use the command

tr -d '\r' < inputfile | >

should that work?

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...

when I try to run the preceding command I get the following error

/Volumes/AraxiVolume_HW07376_J-1/OPS_OutPuts_TimeStampText_For_Naming_Work_Folder/OPS_TempFolderForFiringTrigger/GOLDEN.TERM: line 1: `tr -d '\r' < /Volumes/AraxiVolume_HW07376_J-1/OPS_OutPuts_TimeStampText_For_Naming_Work_Folder/OPS_OutPuts_TimeStamp_SED_INPUT/[0-9]*-OPS_OutPuts_TimeStamp | >'
/Volumes/AraxiVolume_HW07376_J-1/OPS_OutPuts_TimeStampText_For_Naming_Work_Folder/OPS_TempFolderForFiringTrigger/GOLDEN.TERM: line 1: syntax error near unexpected token `newline'

do you know what it is i am doing wrong I am invoking this comnd through a text file

windowstext is a filename.

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...

hmm you make a very good point. Ill clean this up and try again.
Cheers & happy monday

$( ) brackets run a command. $( ls ) for example would dump the output of ls into a string.

What does ./path/to/folder/ do when you type it into a shell? It probably complains it's not a program.

Try " " instead of $( ) when you don't actually want to run something.