Linked Questions
12 questions linked to/from Anything like dos2unix for Windows?
133 votes
14 answers
74k views
Single script to run in both Windows batch and Linux Bash?
Is it possible to write a single script file which executes in both Windows (treated as .bat) and Linux (via Bash)? I know the basic syntax of both, but didn't figure out. It could probably exploit ...
56 votes
8 answers
202k views
Replace CRLF using powershell
Editor's note: Judging by later comments by the OP, the gist of this question is: How can you convert a file with CRLF (Windows-style) line endings to a LF-only (Unix-style) file in PowerShell? Here ...
91 votes
2 answers
21k views
how to make git not change line endings for one particular file?
due to a "feature" in Microsoft's Visual Studio, .sln files must have windows style line endings so that the windows explorer could open them in Visual studio. So I need to be able to commit this one ...
28 votes
5 answers
41k views
On windows, how would I detect the line ending of a file?
I've seen answers to the questions, but those answers are not from a windows perspective from what I can tell. Windows uses CRLF, Unix and Linux use LF, macOS uses LF and classic Mac uses CR. I don't ...
6 votes
2 answers
20k views
how to convert a file from DOS to Unix [closed]
I need to convert a file from DOS to Unix in PowerShell. I know this can be very much easily done in Unix: dos2unix file newfile
0 votes
2 answers
7k views
Powershell v2: Replace CRLF with LF
Using Powershell v2 called from a batch file, I want to replace each CRLF in a file with just an LF. If a file only has LF without any CR, then I want all the LF to be left alone. I do not want a ...
1 vote
3 answers
2k views
Could Not find windows command to convert dos file to unix
The scenario where I am stuck is that I have a normal windows text file 'command.txt' which I am copying on remote(unix) server from my local machine(windows) using 'pscp' command from cmd. The file ...
0 votes
1 answer
2k views
Why is there no such file or directory_profile? [closed]
I am using Windows and MobaXterm. I created a .bash_profile file in the ~ directory and the following line alias sbp="source ~/.bash_profile" is the only code in that file. However, when I was ...
0 votes
1 answer
1k views
Output from Excel to text file using VBA, "UTF-8 Unix" format needed
I have some data in Excel file and I need to share it with somebody. The other side has specific requirements to the format: text file, *.dat name, pipe-separated, etc.. So I created a VBA-code to ...
0 votes
1 answer
422 views
Create linux shell script files in C# (which does not need dos2unix )
I use C# to create shell scripts to automate my tasks in Linux. In order to do this, I use below structure: List<string> batchFileLines = new List<string>(); batchFileLines.Add("shell ...
0 votes
1 answer
87 views
Composing a string in script shell [duplicate]
So I'm trying to compose a string using script shell #!/bin/sh blNumber=1111619832 echo '*'$blNumber+='*.xlsx' I expect the output to be: *1111619832*.xlsx but as a result I get: *+=*.xlsx Btw I ...
0 votes
1 answer
52 views
automatic EOL conversion snippet?
I am working on a batch script that produces the deployment shell script according to my input, and I found my generated shell script has EOL \r\n, so I need to add a procedure to convert this file to ...