[Gllug] Re: Holy War (was Perl Script)

mriscott at yahoo.co.uk mriscott at yahoo.co.uk
Thu Aug 22 11:26:44 UTC 2002


>But, the mantra is "there is more than one way to do it"...they both get the
>job done so we're just starting on the path to holy war, emacs vs vi anyone?

Ah - well you could do it in emacs.

Go to the directory

!ls *.jpeg

Select the whole lot, and rectangle-copy it
(C-X R K and undo).

Rectangle past it after itself

(C-X R Y)

So we now have each filename twice on a line.

In the second set, rectangle-cut the 2 columns we need to move (ie the first xx_).

Rectangle-paste it to the correct place.

Go to the top of the buffer.

Copy a newline.

Search replace "(paste newline)" with "(newline)mv "
 [ ie % C-Y ENTER C-Ymv ENTER

Remove the last extraneous mv.

Save as a file

shell out to chmod +x it

Shell out to run it!

(But that could be considered a sightly over-complicated solution!)

Ian


-- 
Gllug mailing list  -  Gllug at linux.co.uk
http://list.ftech.net/mailman/listinfo/gllug




More information about the GLLUG mailing list