Bash Scripting Help Needed
Mike Reinehr
cmr
Mon Oct 18 10:36:03 PDT 2004
James,
Substituting '\010' for '\n' seems to do the trick.
Mike
On Monday 18 October 2004 06:18 am, James McDonald wrote:
> I have a directory on my Linux box named ~/Admin It contains 2 years of
> scripts and hacks that I used to manage the windows (sorry for swearing)
> boxes at my work.
>
> I am trying to grab all the vbs files under the ~/Admin tree and copy
> them to a location so that I can sort and categorize them.
>
> This piece of code gets me a list
>
> find Admin/ -regex .*vbs$
>
> A sample of the output is as follows (note spaces in file names)
>
> Admin/Tools/Scripting/wsh/Shell Extension - Find Path to
> Files/findPathToFiles.vbs
> Admin/Tools/Scripting/wsh/Telnet Brisbane/telnet_brisbane.vbs
> Admin/Tools/Scripting/wsh/Telnet Brisbane/test.vbs
> Admin/Tools/Scripting/wsh/Toggle Proxy/toggle_proxy.vbs
> Admin/Tools/Scripting/wsh/UseTraceRT2TestLink/test_link.vbs
> Admin/Tools/Scripting/wsh/wallpaper/wallpaper.vbs
> Admin/Tools/Scripting/wsh/WindowsScriptingSecretsCode/Components/index/show
>.vbs
>
> now when I do some thing like
>
> for i in `find Admin/ -regex .*vbs$` ; do echo $i ; done
>
> I get the file name list broken up by the default delimiter of space AND
> newline
>
> Admin/Tools/Scripting/wsh/WMI/Find
> Process
> In
> Server
> Farm/find_process_in_server_farm.vbs
> Admin/Tools/Scripting/wsh/WMI/List
> All
> Processes
> on
> Computer/list_processes.vbs
>
> However I have been trying to do something with the IFS env var
>
> export IFS="" ; for i in `find Admin/ -regex .*vbs$` ; do echo $i ; done
> This just makes the whole list of files into one single argument
>
> export IFS="\n" ; for i in `find Admin/ -regex .*vbs$` ; do echo $i ; done
> This for some odd reason matches on `n' instead of newline
>
>
> Can anyone point out to me how I can use some thing such as above to get
> the list of files with spaces in there names and then copy them to
> another location....
>
>
> Too tired to think....
>
> James
>
>
>
>
> _______________________________________________
> Linux-users mailing list
> Linux-users at linux-sxs.org
> http://mail.linux-sxs.org/cgi-bin/mailman/listinfo/linux-users
--
Debian 'Sarge': Registered Linux User #241964
----
"More laws, less justice." -- Marcus Tullius Ciceroca, 42 BC
--------
More information about the Linux-users
mailing list