Any of your options tried does what you want them to do, so I guess your file has some "hidden" features like e.g. non-printing control characters. Try
So it is confirmed now that \r carriage characters are present in your Input_file, so could you please first remove them and then try your any of the code mentioned in POST#1 and let us know how it goes then.
You are essentially trying to read from a file, make some changes and write back to it. It doesn't work the way it looks. (*)
A few options are:
1) If your sed version allows it, try the "in-place edit" modifier; something like "sed -i". Check your sed manual "man sed".
2) Use a temporary file as you did for the "tr" command.
======
(*)
As for why it doesn't work the way it looks - you have two different processes (a) a read process and (b) a write process, both sharing the same resource - your file. When they are executed by the OS, a race condition occurs between them which renders the final output unpredictable.
If the writing is done before the reading, you get a zero-byte file. If the writing is done mid-way during the reading process, you may get a "half-baked" output file. The safest way, therefore, is to either use a temporary file explicitly or let sed do it via the "-i" modifier - which is not available in all sed versions.
You could also use other tools - Bash, awk, Perl etc. but the temporary file will be involved, either explicitly or implicitly.
That tr command worked for me. Also && condition will make sure like first reading of Input_file and it's output's redirection is done then only it will go to next command which is mv temp_Input_file Input_file , ideally it shouldn't fail. Kindly do let me know your views on same.
Yes the issue was that I was copying the values from windows to unix and carriage return was entered. As suggested I entered the values in unix and used