Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Sort command included in Cygwin launched by normal Windows promppt don't accept $ operator for tab character

I have installed Cygwin on my machine and I would to know if there exist a way to use full power of sort command also with the normal DOS prompt.

I have read this question: Unix Sort with Tab Delimiter and the command to sort a tabbed file using the second column is:

sort -t $'\t' -k 2 file.txt

If I launch the command inside the Cygwin environment it works like expected, if I launch it from the normal Windows prompt (I have renamed sort.exe into xsort.exe to avoid conflicting with native Windows sort command) it doesn't works, it not recognize the $ operator and it see \t like two distinct characters and operation fails.

Is it possible to make it working also from the DOS prompt?

like image 567
gialloporpora Avatar asked Oct 26 '25 10:10

gialloporpora


1 Answers

This is regulated by PATH environment variable.

Under DOS prompt run the following:

echo %PATH%

You will see the path C:\cygwin\bin after c:\Windows\system32.

This means that Windows's sort.exe will be used for command sort.

You will need to edit environment variable PATH for your Windows to move c:\cygwin\bin to the left of C:\Windows\system32.

like image 114
Denis Postanogov Avatar answered Oct 28 '25 23:10

Denis Postanogov



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!