Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Help with long path 2

Status
Not open for further replies.

desperateUser

Technical User
Aug 4, 2005
47
CA
All I need to do is pull the following from each file on another server

Code:
BEGIN { print "Section 235" >"sec_235.txt"}

/SECTION 235/ , /S570/ { print $0 >>"sec_235.txt" }

I'm trying to use a batch file using this syntax:
Code:
awk -f SEC235.awk "\\telecom\ROPS-DATA\ROP Archive 2005\Recent Logs\*.txt"

If I use "\\telecom\ROPS-DATA\ROP Archive 2005\Recent Logs\actual file name here.txt" it works. However I don't want to have to enter each file name in -- naturally.

I am a windoze gurl trying my hand at this command line stuff using a CMD window on Windows2000 Professional.

Pleeze help...
Thanks
Penelope
 
Perhaps this ?
cd "\\telecom\ROPS-DATA\ROP Archive 2005\Recent Logs"
awk -f SEC235.awk *.txt

You'll have to change the output path in the awk program.

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ181-2886
 
I don't think you can cd onto a CIFS share, you might have to do something like this instead:

[tt]net use x: \\telecom\ROPS-DATA
x:
cd "ROP Archive 2005\Recent Logs"
...[/tt]

...and continue as PHV suggested.

Annihilannic.
 
Annihilannic, your net use hint was right on target. However, it seems the target is put before the programming, i.e., it navigates to the correct place THEN tells me it can't find the files I'm using (the batch file and the awk file.)

Do I put copies in the target folder?
 
No, you can just refer to them by full path name:

Either:

[tt]awk -f C:\MyAwkScripts\SEC235.awk *.txt[/tt]

Note that you will need to specify the full path of your sec_235.txt output file if you want it to be created elsewhere.

Alternatively, don't cd into the directory at all and:

[tt]awk -f SEC235.awk "X:\ROP Archive 2005\Recent Logs\*.txt"[/tt]

Annihilannic.
 
Something isn't right then.

I can see it changing to x: and running this...
Code:
awk -f "C:\ROPS\SEC235.awk" "X:\ROP Archive 2005\Recent Logs\*.txt" 'awk' is not recognized as a n internal or external command, operable program or batch file.

x:
 
Trouble is, your command interpreter doesn't know how/where to find the awk.exe program file. Either modify your %PATH% variable or locate the awk file yourself:

C:\awk\program\dir\awk -f "C:\ROPS\SEC235.awk" "X:\ROP Archive 2005\Recent Logs\*.txt"

(substitute whatever drive letter and full path name where the AWK program is located on your machine)


HTH,

p5wizard
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top