Invisible characters in txt after batch echo in windows and grep in linux

by Renver   Last Updated July 12, 2019 08:00 AM

in my windows Batch file i search for run date of windows.

  • I execute uptime,
  • get with for /f "delims"(...) just a day
  • echo that to file

Next I sent it to my linux server where in sh script I

  • use grep "[0-99]" with my file
  • case when some numbers occurs in file from windows.

My problem is - the file from windows hase some characters (I assume) and my script return (null), when I manually enter that txt file from windows, and delete spaces after number of days, save it, and exit, my script returns right case action.

What should I do, in Windows or in Linux, to get rid of that problem. And I will be glad if You would provide me information, what is going on, why does that problems occurs.

I have checked google for 3 days, till I request for help here - with no special solution.

Related Questions

Updated September 04, 2017 21:00 PM

Updated September 11, 2017 19:00 PM

Updated August 13, 2017 09:00 AM

Updated April 30, 2019 10:00 AM