You are not logged in.
Pages: 1
im looking for a way to remove all spaces and special charachters from a text file any ideas ???
e.g.
from
Server Name Remark
-------------------------------------------------------------------------------
\\JAYDELL1
\\LIONEL
\\OPTIMATERM
\\ROB Optima Optiplex 1
\\SBSERVER2003
\\VAIO-LIONEL
The command completed successfully.
to
JAYDELL1
LIONEL
OPTIMATERM
ROB
SBSERVER2003
VAIO-LIONEL
I can get as far as removing the odd line etc e.g. the first line but am having difficulty figuring out how to do the rest
Offline
I'm guessing you're doing a "net view" there ... you could use the "for /f" command to achieve the results you want.
In a script, something like this should do it:
for /f "usebackq tokens=1 skip=3 delims=\ " %%a in (`net view ^| find /v "The command completed successfully."`) do echo:%%~a
Last edited by bluesxman (17 Oct 2008 13:16)
cmd | *sh | ruby | chef
Offline
lol you make this look easy !!!
What is the usebackq ?
i havnt seen that before ...
Offline
It changes the semantics of the "for" command, such that it uses back-quotes >`< rather than straight quotes >'< to wrap around a command, plus a couple of other bits. I do a lot of "for" work from text files, so you generally need it to allow long file names, so use it by force of habit.
cmd | *sh | ruby | chef
Offline
thank you
A real good tidbit of information there
Offline
Pages: 1