[ale] Stupid Shell Trick

Wandered Inn esoteric at denali.atlnet.com
Wed Feb 10 11:51:45 EST 1999


This works with pdksh and appears to work with bash:

for fn in *\;* ;do
mv $fn ${fn%\;*}
done

This will get any file of the form of *\;* you can restrict it to files
named *\;?? and *\;? by replacing the *\;* in the 'for fn in' line with
the *\;?? *\;?


jeff_hubbs at mcgraw-hill.com wrote:
> 
> I need a suggestion for a "stupid shell trick" for bash.
> 
> I have a directory tree full of files.  The names of the files end with an
> extension (i.e., dot followed by some characters) followed by a semicolon
> and a number, like so:
> 
>      text.fdl;1
>      tplbl.jet;1
>      tqm.txt;1
>      tqm2.txt;2
>      vaxnet.exe;1
>      vmodem.exe;2
>      vmodem.log;1
>      vt340_colors.txt;1
>      vt340_logout.txt;54
>      warn.com;1
> 
> [Note: these are VMS filenames, if you're wondering]
> 
> I want to go through the entire tree renaming these files so as to
> eliminate the semicolon and everything after, like:
> 
>      text.fdl
>      tplbl.jet
>      tqm.txt
>      tqm2.txt
>      vaxnet.exe
>      vmodem.exe
>      vmodem.log
>      vt340_colors.txt
>      vt340_logout.txt
>      warn.com
> 
> Any ideas?
> 
> Thanks,
> - Jeff

--
Until later: Geoffrey		esoteric at denali.atlnet.com

You mean you paid MONEY for Service Pack '98????






More information about the Ale mailing list