[Israel.pm] multi move script

Shlomi Fish shlomif at iglu.org.il
Sun Aug 22 10:35:58 PDT 2004


On Sun, 22 Aug 2004 20:12, Shlomi Bakish wrote:
> Does anyone have or know of a script that enables doing mv with
> wildcards  in unix (similar to dos move) ?
> I'm sure someone already wrote it before, as this is a very useful
> command, and I was very supprised to see
> that unix don't support what dos supported for years before.
>
> for example :
>
> mv    try_*.txt    work_*.txt
>

for I in try_*.txt ; do
	mv "$I" "work_$(echo "$I" | sed 's!^try_!!)".txt
done

# Note - not tested.

The above command line won't work in UNIX because wildcards expand to the list 
of files which are themselves placed in @ARGV for the command to process. 
This facilitates writing programs that work on several files.

Regards,

	Shlomi Fish

-- 

---------------------------------------------------------------------
Shlomi Fish      shlomif at iglu.org.il
Homepage:        http://shlomif.il.eu.org/

Knuth is not God! It took him two days to build the Roman Empire.



More information about the Perl mailing list