Page 1 of 1

Cut Command Not Working

Posted: 04 Sep 2015 06:30
by btpoole
I have a fairly simple script that sets a base path, opens a txt file, reads the line, cuts the file into parts based on characters. The same script had been working fine a year ago but for some reason it will not execute now. When I run the following, the command window flashes up and closes. I can't even get a pause, timeout or wait to hold it in order to read results. The script is on Windows 7 pro. I know the path is correct and the file exist, actually it creates the nametemp file as needed but it is always empty.

set bpath="C:\server\htdocs\mydirec\input.txt"
findstr ":" %bpath% | cut -f1 -d ":" > %bpath%\data\nametemp

Re: Cut Command Not Working

Posted: 04 Sep 2015 06:44
by Squashman
So you are saying this path exists?

This what your variable is expanding to.

Code: Select all

findstr ":" "C:\server\htdocs\mydirec\input.txt" | cut -f1 -d ":" > "C:\server\htdocs\mydirec\input.txt"\data\nametemp


Why would your folder path have the file name with extension in it?

Quotes need to be around the whole path. Not just part of it.

Re: Cut Command Not Working

Posted: 06 Sep 2015 09:23
by btpoole
Thank you greatly, had to modify the path so with your suggestions.