[please keep the list and bug-tracker in the loop] On 09/10/2010 06:07 AM, David Longstaff wrote:
I have since determined that the problem is using the double quote character (") as the delimiter:This works:- **************************************************************************** ******* C:\Users\drl.drlpc>cat "Table of Contents.txt"|findstr "name=\"Name\""|cut -d = -f 3>> strippedcontents.txt
Aha! Your problem is that you are using cmd as your shell, which has completely different quoting rules than Unix-y shells. It would have been helpful if you had told us you were using a Windows port in the first place.
**************************************************************************** ******** This doesn't:- **************************************************************************** ******** C:\Users\drl.drlpc>cat "Table of Contents.txt"|findstr "name=\"Name\""|cut -d " -f 3>> strippedcontents.txt cut: the delimiter must be a single character Try `cut --help' for more information.
Makes sense - the " is a quoting character in cmd, which meant the entire rest of your command line was passed as a single argument to cut; but cut correctly told you that a multi-character argument is inappropriate for -d. It doesn't help that cmd apparently tries to be helpful by letting you use quoted strings without at terminating ".
**************************************************************************** ******** Nor does this:- **************************************************************************** ******** C:\Users\drl.drlpc>cat "Table of Contents.txt"|findstr "name=\"Name\""|cut -d '"' -f 3>> strippedcontents.txt cut: the delimiter must be a single character Try `cut --help' for more information.
cmd doesn't use '' for quoting, just " and \.
**************************************************************************** ******** Nor this:- **************************************************************************** ******** C:\Users\drl.drlpc>cat "Table of Contents.txt"|findstr "name=\"Name\""|cut -d \" -f 3>> strippedcontents.txt cut:>>: Invalid argument
cmd apparently also fails to treat >> as an append operator, and instead treats it as an argument.
It seems to me that your real problem is that you are using the wrong shell for your expectations. Have you considered using cygwin (see cygwin.com), which comes with bash or tcsh pre-built for Windows, and where you can blindly use Unix shell conventions without having to worry about the brain-dead semantics of cmd?
-- Eric Blake [email protected] +1-801-349-2682 Libvirt virtualization library http://libvirt.org
