Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top
gawk '{print $1|"sort"}' somfile

This will do in cygwin bash, but in cmd.exe, it failed. My gawk's version info:

C:\Documents and Settings\Administrator>gawk --version

GNU Awk 3.1.5

share|improve this question

Perhaps because in cmd.exe you have to use double-quotes (") not apostrophe (') to delimit parameters.

  gawk "{print $1|\"sort\"}" somefile


share|improve this answer
Close ;). You need the outer double quotes to make gawk recognize the whole expression, but the inner single quotes must be double quotes as well, so they need to be escaped: gawk "{print $1|\"sort\"}" somefile – Ansgar Wiechers Sep 20 '12 at 9:19
@AnsgarWiechers: Thanks for the correction. I'll update the answer accordingly. – RedGrittyBrick Sep 20 '12 at 10:04

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .