thebjorn
thebjorn

Reputation: 27321

Redirect `tr -d` on windows?

I can't find a way to redirect the output of GnuWin32's tr to a file:

(dev) go|w:\srv> dkversion . | jq .vcs | tr -d \" > vcs.txt
tr: extra operand `>'
Try `tr --help' for more information.
Error: writing output failed: Invalid argument

The dkversion . | jq .vcs command outputs "svn", so to reproduce it with a simpler testcase:

(dev) go|w:\srv> echo "svn"
"svn"

(dev) go|w:\srv> echo "svn" | tr -d \"
svn

(dev) go|w:\srv> echo "svn" | tr -d \" > vcs.txt
tr: extra operand `>'
Try `tr --help' for more information.

on linux echo '"svn"' | tr -d '"' > foo.txt works, so I'm guessing the problem has to do with the quoting of the "..? I haven't been able to figure out what the correct syntax would be though..

Upvotes: 0

Views: 782

Answers (1)

CiaPan
CiaPan

Reputation: 9570

Put redirection before options:

tr > vcs.txt -d \"

Upvotes: 1

Related Questions