Re: File names with spaces

2003-02-28 Thread Mike Castle
In article <[EMAIL PROTECTED]>, <[EMAIL PROTECTED]> wrote: >for file in `ls -1`; do > newfile=`echo "$file" | sed 's/ /_/'` > echo "File is named ${file}" > echo "The new file is named ${newfile}" > > mv "$file" "$newfile" >done > >IHMO in the main-loop it is better to choose "ls -1", so the

Re: [SOLVED] Re: File names with spaces

2003-02-23 Thread J.
On Sun, 23 Feb 2003, Theo. Sean Schulze wrote: > On Fri, Feb 21, 2003 at 09:59:37AM +0100, J. hunted and pecked out: > [snip] > > > > BTW, > > > > please remember that `blank' is a GNU extension, regarding portability > > issues.. etc.. > > > > ~$ man isblank > > > This shouldn't be a problem,

Re: [SOLVED] Re: File names with spaces

2003-02-23 Thread Theo. Sean Schulze
On Fri, Feb 21, 2003 at 09:59:37AM +0100, J. hunted and pecked out: [snip] > > BTW, > > please remember that `blank' is a GNU extension, regarding portability > issues.. etc.. > > ~$ man isblank > This shouldn't be a problem, since I will only be using it on GNU/Linux. Also, [:blank:] is a ch

Re: [SOLVED] Re: File names with spaces

2003-02-21 Thread J.
On Thu, 20 Feb 2003, Theo. Sean Schulze wrote: > J., > > Thanks for your suggestions. While googling comp.unix.shell today, I found yet >another method. I was not aware that "*" when used by itself matches every filename >in a directory. Apparently, part of the problem I was having was a sid

Re: [SOLVED] Re: File names with spaces

2003-02-20 Thread J.
On Thu, 20 Feb 2003, Theo. Sean Schulze wrote: > J., > > Thanks for your suggestions. No problemo, btw: 4 out of 5 pages on teamfinders.org are generating http 404 not found messages. I think you should have a critical look at all the http links in the main page. J. - To unsubscribe from t

[SOLVED] Re: File names with spaces

2003-02-20 Thread Theo. Sean Schulze
J., Thanks for your suggestions. While googling comp.unix.shell today, I found yet another method. I was not aware that "*" when used by itself matches every filename in a directory. Apparently, part of the problem I was having was a side effect of ls and find. Here is the script that I use

Re: File names with spaces

2003-02-20 Thread J.
On Tue, 18 Feb 2003, Theo. Sean Schulze wrote: > Thanks, that did help, although it didn't solve the problem. > I now recognize that the problem is in assigning the variable. > Both my version with ls and the version with find in the example give > the expected results when printing to the con

Re: File names with spaces

2003-02-18 Thread Theo. Sean Schulze
Thanks, that did help, although it didn't solve the problem. I now recognize that the problem is in assigning the variable. Both my version with ls and the version with find in the example give the expected results when printing to the console, but they both fail when used to assign a string i

Re: File names with spaces

2003-02-18 Thread Jim Reimer
[EMAIL PROTECTED] wrote: A solution should look like this: for file in `ls -1`; do newfile=`echo "$file" | sed 's/ /_/'` echo "File is named ${file}" echo "The new file is named ${newfile}" mv "$file" "$newfile" done IHMO in the main-loop it is better to choose "ls -1", so the field se

Re: File names with spaces

2003-02-18 Thread robin
> I am trying to write a bash shell script that > will translate spaces in file names into > underline characters. This is the script as I > have it now: > > for file in `ls` > do > echo $file > newfile=`ls ${file} | tr '[:space:]' '[_*]'` > echo File is named ${file} > echo The new file is n

Re: File names with spaces

2003-02-17 Thread Brian Jackson
You can try to adapt this example from The Advanced Bash Scripting Guide: http://www.tldp.org/LDP/abs/html/moreadv.html#EX57 It deletes the file, but it shouldn't be too hard to adapt to your needs. --Brian On Monday 17 February 2003 01:11 pm, Theo. Sean Schulze wrote: > Hello, > > I am trying t

File names with spaces

2003-02-17 Thread Theo. Sean Schulze
Hello, I am trying to write a bash shell script that will translate spaces in file names into underline characters. This is the script as I have it now: for file in `ls` do echo $file newfile=`ls ${file} | tr '[:space:]' '[_*]'` echo File is named ${file} echo T