Welcome to Dream.In.Code
Become an Expert!

Join 136,888 Programmers for FREE! Get instant access to thousands of experts, tutorials, code snippets, and more! There are 1,755 people online right now. Registration is fast and FREE... Join Now!




Making a BAT file for AWK

 
Reply to this topicStart new topic

Making a BAT file for AWK, can someone help me with this problem

xesecre
29 Jul, 2008 - 05:23 AM
Post #1

New D.I.C Head
*

Joined: 29 Jul, 2008
Posts: 12

Hello everyone, the problem I am haveing in AWK or NAWK

I learned how to use AWK in DOS and it works well, I also learned how to make a BAT file


here is what I have in the BAT file and it works fine

[code]nawk.exe -f C:/awk/programfiles/duplicates.txt C:/awk/in/*.* > C:/awk/out/test.txt[code]



here is the programming language for finding duplicates

[code]!($1 in a);{a[$1]}[code]


I want to combine what have in the bat along with the programming language in the seperate file so I can contain everything inside the bat

sort of like this but this one doesnt work

[code]nawk.exe -f !($1 in a);{a[$1]} C:/awk/in/*.* > C:/awk/out/test.txt[code]

any help will be much appreciated
thanks
John
User is offlineProfile CardPM
+Quote Post

Tom9729
RE: Making A BAT File For AWK
29 Jul, 2008 - 06:20 AM
Post #2

Debian guru
Group Icon

Joined: 30 Dec, 2007
Posts: 1,461



Thanked: 10 times
Dream Kudos: 325
My Contributions
Well I don't know anything about AWK, but I do know you need to close your code tags.

Also, you could get away with using the [ inline ] [ / inline ] tags (minus the spaces) for the code that you've posted.

I know this doesn't answer your question, but it will help others be more responsive. smile.gif
User is offlineProfile CardPM
+Quote Post

xesecre
RE: Making A BAT File For AWK
29 Jul, 2008 - 06:42 AM
Post #3

New D.I.C Head
*

Joined: 29 Jul, 2008
Posts: 12

QUOTE(Tom9729 @ 29 Jul, 2008 - 07:20 AM) *

Well I don't know anything about AWK, but I do know you need to close your code tags.

Also, you could get away with using the [ inline ] [ / inline ] tags (minus the spaces) for the code that you've posted.

I know this doesn't answer your question, but it will help others be more responsive. smile.gif



Hello Tom and thanks for your quick reply

Those quotes I have at the beginning
CODE
are not the actual code

I tried to abide by post standards which said
Use BBCode when posting. For example: [code]Paste Your Code Here



I am new here and certainly need a lot more education on codes but I am trying to get by
thanks for the reply
John
User is offlineProfile CardPM
+Quote Post

Tom9729
RE: Making A BAT File For AWK
29 Jul, 2008 - 06:53 AM
Post #4

Debian guru
Group Icon

Joined: 30 Dec, 2007
Posts: 1,461



Thanked: 10 times
Dream Kudos: 325
My Contributions
nawk.exe -f C:/awk/programfiles/duplicates.txt C:/awk/in/*.* > C:/awk/out/test.txt

!($1 in a);{a[$1]}

nawk.exe -f !($1 in a);{a[$1]} C:/awk/in/*.* > C:/awk/out/test.txt

You're forgetting to close your tags was all I was saying. smile.gif
User is offlineProfile CardPM
+Quote Post

xesecre
RE: Making A BAT File For AWK
29 Jul, 2008 - 07:45 AM
Post #5

New D.I.C Head
*

Joined: 29 Jul, 2008
Posts: 12

Hello Tom
Now I see what you are saying
thanks again
John
User is offlineProfile CardPM
+Quote Post

perfectly.insane
RE: Making A BAT File For AWK
31 Jul, 2008 - 01:42 PM
Post #6

D.I.C Addict
Group Icon

Joined: 22 Mar, 2008
Posts: 558



Thanked: 46 times
Dream Kudos: 25
Expert In: C/C++

My Contributions
When executing awk scripts given directly on the command line, they need to be quoted properly.

nawk.exe "!($1 in a);{a[$1]}" C:/awk/in/*.* > C:/awk/out/test.txt

Notice the double quotes. I believe that this is correct for cmd.exe. In Unix, you'd normally use single quotes, as that would prevent the shell from processing the $1 characters, but in cmd.exe doesn't understand the $1 syntax, so you're safe. I don't think single quotes work the same way for Windows (at least, the internal function that splits the arguments).

Also, the -f needs to be removed, as your command isn't located in an external file.

This post has been edited by perfectly.insane: 31 Jul, 2008 - 01:46 PM
User is offlineProfile CardPM
+Quote Post

Fast ReplyReply to this topicStart new topic
Time is now: 12/3/08 09:06PM

Live Help!

Tutorials

Programming

Web Development

Reference Sheets

Code Snippets

DIC Chatroom

Bye Bye Ads

Monthly Drawing

Thumb Drive

Top Contributors

Top 10 Kudos This Month