On 16 Mar 2003, Kleiner Hampel wrote: > Hi, > > now it works, but because of the '*'. > > now i want to remove the leading abc from all files in my directory. > i tried this: > > for i in *; do mv $i `echo $i | sed s/abc//`; done > > but it doesn't do that. > i always get the error, that the last arguement must be a directory! > I guess, the reason are the white spaces in the names. > perhaps the expression `echo $i | sed s/abc//` also have to be set in '' > or so, but it doesn't work this way. > > please help > > regards, > hampel > for i in *; do temp=$(echo $i | sed s/abc.//) ; mv "$i" "$temp" ; done
The . after abc is so your file names do not start with a space. You need the quotes around both $i and $temp so that they are treated as a single file name. You may want to modify the sed expression to remove all the spaces when you have more then one space after abc. Mikkel -- Do not meddle in the affairs of dragons, for you are crunchy and taste good with ketchup. -- redhat-list mailing list unsubscribe mailto:[EMAIL PROTECTED] https://listman.redhat.com/mailman/listinfo/redhat-list