Solved Anyone knows how to use command grep and awk?

July 16, 2013 at 09:50:57
Specs: Windows XP
Hi guys,

I'm learning how to use MS-Dos and I have a code to implement:
Quote:
gpdcreport my_run.report -gm -m 1 | gprofile -vs -resample -d 50 -n 50 | grep -v "#" | awk '{print $2,$1}' | gphistogram -y-min 150 -y-max 3500 -x-min 1 -x-max 50 -x-count 50


This works just fine, till the command grep and awk
Anyone knows how to solve this?

Probably it's a dumb question. I'm a newbie in Ms-dos.
Thanks


See More: Anyone knows how to use command grep and awk?

Report •

#1
July 16, 2013 at 12:03:27
Both Grep and Awk are Unix commands. They will not work in a DOS environment.
~winipcfg

ASCII question, get an ANSI


Report •

#2
July 16, 2013 at 13:31:13
✔ Best Answer
There are Windows versions of both grep & awk that you can use.

Look here:

http://unxutils.sourceforge.net/

You want the file UnxUpdates.zip

MIKE

http://www.skeptic.com/


Report •

#3
July 17, 2013 at 07:03:06
Thank you guys.

I tried to use UnxUpdates.zip, but there are no awk command in there.
However grep one works just fine.
Just in case, I tried also to use gawk.exe, because it's a similar name, but then it gives me an error when it comes to gawk '{print $2,$1}'.


Report •

Related Solutions

#4
July 17, 2013 at 07:57:57
The UnxUpdates.zip package are GNU implementations
so the AWK command is listed as GAWK
and in the alphabetical listing is right next to GREP.

Edit Added:

Next time I'll read the whole reply, sorry.

Not sure why your getting an error message,
It's been a long time since I last used AWK but the string:

gawk `{ print $1, $2 }`

appears correct.

The only thing I can think of is the single quotes around the AWK,
if I remember correctly they should be a "back tick".
On regular key board, top row, it is the symbol next to the number 1 below the Tilde mark ~

A regular quote > '
A back tick > `
Not sure you can see the difference.

The grep -v is an invert-match

to select non-matching lines.

Also on the grep -v
Try a single quote or back tick around your hash tag: '#' or `#`

I have no idea on the other commands.

Sorry I can't be of more assistance.

You might ask your question in the Linux or Unix forums
someone there, who uses the commands on a more regular
basis, might be of more assistance.


MIKE

http://www.skeptic.com/


Report •

#5
July 17, 2013 at 17:25:38
There was a DOS version of grep distributed with one of the Borland packages, probably TurboPascal. If you can find it, just run it incorrectly and it will spit out a bunch of directions. I use it for foxpro programs to find all occurances of something in my programs. For example, if I want to see all the program that open a table named Invoices, I would

grep - i invoices *.prg

That would search all the files that end with prg for invoices and the "i" parameter would ignore case.


Report •

Ask Question