Gawk help (windows)


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Gawk help (windows)
# 8  
Old 02-22-2011
Quote:
Originally Posted by harris_t
Thanks Franklin52 , but I just get a blank output. Smilie
Strange..this is what I get as output (with gawk windows):
Code:
G:\gawk>type file
pool.ntp.org[155.101.3.115:123]:
ICMP: 73ms
NTP: +0.0162516s RefID: 127-67-113-92.pool.ukrtel.net [92.113.67.127]

G:\gawk>gawk -F":" "$1==\"NTP\"{gsub(/[^0-9\.]*/,\"\",$2);print $2}" file
0.0162516

# 9  
Old 02-22-2011
Weird... could you upload me your gawk.exe lol .

Maybe I don't have gsub installed? I would suppose it'd give me an error if that was the reason..

Last edited by harris_t; 02-22-2011 at 04:11 AM..
# 10  
Old 02-22-2011
Quote:
Originally Posted by harris_t
Weird... could you upload me your gawk.exe lol .

Maybe I don't have gsub installed? I would suppose it'd give me an error if that was the reason..
You can get the latest version here:

Gawk for Windows
# 11  
Old 02-22-2011
Yep that's what I'm using..Smilie

Image

Last edited by harris_t; 02-22-2011 at 04:22 AM..
# 12  
Old 02-22-2011
Maybe put the awk code into a file, e.g. prog.txt then call using -f
Code:
awk -F: -f prog.txt time.txt

# 13  
Old 02-22-2011
No. That gives me some warning escape sequence error.
# 14  
Old 02-22-2011
Code:
sed '/^NTP:/!d;s:[^0-9]*\([0-9\.]*\).*:\1:' infile

Login or Register to Ask a Question

Previous Thread | Next Thread

5 More Discussions You Might Find Interesting

1. Windows & DOS: Issues & Discussions

Gawk on Windows: Joining lines only if 1st field matches

Hi.. i have two files:: file_1:: mOnkey huMAnfile_2:: Human:hates:banana i:like:*** Monkey:loves:banana dogs:kill:catsdesired output:: Monkey:loves:banana Human:hates:bananaso only when the 1st field matches from both files print it from file_2 ((case-sensitive)) i also would like... (21 Replies)
Discussion started by: M@LIK
21 Replies

2. Windows & DOS: Issues & Discussions

Gawk Script in Windows batch file - Help

Good morning all. I have been running into a problem running a simple gawk script that selects every third line from an input file and writes it to an output file. gawk "NR%3==0" FileIn > FileOut I am attempting to run this command from a batch file at the command line. I have several hundred... (6 Replies)
Discussion started by: 10000springs
6 Replies

3. Shell Programming and Scripting

Gawk Help

Hi, I am using the script to print the portion of the file containing a particular string. But it is giving error "For Reading (No such file or directory). I am using cygwin as unix simulator. cat TT35*.log | gawk -v search="12345678" ' /mSOriginating /,/disconnectingParty/ { ... (1 Reply)
Discussion started by: vanand420
1 Replies

4. Shell Programming and Scripting

How can I make running gawk scripts more user-friendly in a Windows environment?

I know, and I apologise for using the W word, but I have users asking if they can use my gawk scripts, but I just know they're not going to like using the DOS command line. Is there any way for me to run my gawk scripts from a gui? Even if it's from a web page (html, php, what ever). I do not... (3 Replies)
Discussion started by: jonathanm
3 Replies

5. Shell Programming and Scripting

gawk HELP

I have to compare records in two files. It can be done using gawk/awk but i am unable to do it. Please help me File1 ABAAAAAB BC asa sa ABAAABAA BC bsa sm ABBBBAAA BC bxz sa ABAAABAB BC csa sa ABAAAAAA BC dsa sm ABBBBAAB BC dxz sa File 2 ABAAAAAB BC aas ba ABAAAAAB BC asa sa... (6 Replies)
Discussion started by: sandeep_hi
6 Replies
Login or Register to Ask a Question