|
Answer» Hi, Never did dos batch programming. I have a text file. I want to sort from column 10 thru 15 and I want to eliminate duplicates. How can i do this?
Thanks for your HELP, akondetiduplicates of what? give us an example of the text fileThanks for responding.
Here is my file layout (comma delimited)
Raja,[emailprotected],732-567-0987 Sam,[emailprotected],654-654-8970 Joda,[emailprotected],765-987-0987 Raja1,[emailprotected],743-546-0987 Som,[emailprotected],876-657-9087
(a)I want to sort the file on field 2 which is the e-mail address (b)I want to eliminate duplicates on field 2 i.e e-mail address (c)I want to write the output(unique e-mail ids) to a DIFFERENT text file.
How can i accomplish the above. Thanks in advance for your help. no easy way to do that in DOS ( you can try meddling with sort that comes with Windows though). However, here's a simpler way, if you can download GNU sort for windows here
this is all you need. Code: [SELECT]sort -t"@" -k2,2 file Hi, Thanks for your help. I will try downloading.
Regards, akondetiHi, i have downloaded the coreutils from GNUWin32 and installed them But when i type the following command, it is giving error
C:\Users\Chola>sort -t "@" -k2,2 email-list.txt Input file specified two TIMES.
(a)After downloading and installing the core utils, do i have to do anything else?
The GNUWin32 is installed at C:\Program Files\GnuWin32
Please advise.
The input file has the following records Raja,[emailprotected],732-567-0987 Sam,[emailprotected],654-654-8970 Joda,[emailprotected],765-987-0987 Raja1,[emailprotected],743-546-0987 Som,[emailprotected],876-657-9087
and (a)I want to sort the file on field 2 which is the e-mail address (b)I want to eliminate duplicates on field 2 i.e e-mail address (c)I want to write the output(unique e-mail ids) to a different text file.
Thanks, akondetiyou have downloaded to C:\Program Files\GnuWin32, however, you are running sort in c:\users\chola without specifying the full path to GNU sort. therefore, the OS is using the sort provided by M$. Either provide the full path, or configure your $PATH to include C:\Program Files\GnuWin32. Make sure you put it in front of C:\windows\system32I have the core utils, and I have copied the GNU echo.exe to a folder on my PATH and renamed it gnuecho.exe to avoid precisely this problem. O.K I have made changes to my PATH and it is working.
Thanks a lot for all your help.
Got a quick question though. The gnu core utils does not include grep, the very popular and useful unix command. Is this not a core util? Any way to have grep on windows/dos?
Quote from: akondeti on July 10, 2008, 10:19:50 PM Any way to have grep on windows/dos? The GNU core utils is not the only collection of unix utilities ported to Win32. There are others, INCLUDING a small set called Unxutils which does have grep.exe
http://unxutils.sourceforge.net/ Quote from: akondeti on July 10, 2008, 10:19:50 PM Got a quick question though. The gnu core utils does not include grep, the very popular and useful unix command. Is this not a core util? Any way to have grep on windows/dos?
its' here go to the root URL to see more.
|