b3ta.com qotw
You are not logged in. Login or Signup
Home » Question of the Week » Redundant technology » Post 953749 | Search
This is a question Redundant technology

Music on vinyl records, mobile phones the size of house bricks and pornography printed on paper. What hideously out of date stuff do you still use?

Thanks to boozehound for the suggestion

(, Thu 4 Nov 2010, 12:44)
Pages: Latest, 14, 13, 12, 11, 10, ... 1

« Go Back | See The Full Thread


Am I breaking rules by chatting bout this? Please don't ban me, I'm just feeling chatty.

reaname 10* to 100* in a command shell means:
Take the first file that begins with with 10 and ends with anything, then make it begin with 100 and end it with what was already there. Overwriting as you go.

The shell isn't reaplacing 10 with 100, it is putting 100 at the beginning of the file, ovewriting what is already there. I can't remember bash so well, but I it works similar. Something like:
for f in 10*; mv $f 100`echo "$f" | cut 1-2`; done

Get a list of files 'f' that begins with 10, move $f to 100$f(with the first 2 characters (hopefully 10) cut off)

Don't copy and paste that into bash, I'm on a windows box now. I'm working with a very old manbrain.
(, Thu 4 Nov 2010, 19:01, 1 reply)
On some csh shells you get rename:
rename 50 100 50*

Job done. DOS makes me feel a bit sick. It's like a proper shell's crippled cousin
(, Thu 4 Nov 2010, 20:26, closed)
Smiles...
All these replies have actually been interesting to read! As someone who still plays with command prompts and writes the odd script at work I love stuff like this!
(, Thu 4 Nov 2010, 23:48, closed)

/bin/csh

% ls
50test.txt
% rename 50 100 50*
% ls
50test.txt

didn't work.

I think (don't know) that 'rename' is a PERL script that's unlikely to be influenced much by the shell it's running on.

however rename does accept perl regexps... so you could use:
rename 's/^50/100/' 50*

Better than my messy sub routine.
(Just confirmed on my Gentoo system)
(, Fri 5 Nov 2010, 3:15, closed)

« Go Back | See The Full Thread

Pages: Latest, 14, 13, 12, 11, 10, ... 1