[olug] Unix Tip: MOVING FILES AROUND
    Unix Guru Universe 
    listserv at ugu.com
       
    Sun Dec 15 19:01:55 UTC 2002
    
    
  
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
			      UNIX GURU UNIVERSE 
			         UNIX HOT TIP
			Unix Tip 2175 - December 15, 2002
		    http://www.ugu.com/sui/ugu/show?tip.today
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
MOVING FILES AROUND
Here is another way to move
files around.
Sometimes you find yourself 
wanting to move a bunch of 
files into a new directory 
that is to be created in the 
current working directory. 
Rather than using a temporary 
directory, or grep and variable
substitution; use a subshell:
$ ( \ls; echo dir; mkdir dir ) | xargs mv
The trick is in using a subshell 
to run a number of commands 
_before_ the output is piped to 
xargs. This idiom is also useful 
for plenty of other applications.
--------------------------------------------------------------------------
To Subscribe:    http://www.ugu.com/sui/ugu/show?tip.subscribe
To Unsubscribe:  http://www.ugu.com/sui/ugu/show?tip.unsubscribe
To Submit A Tip: http://www.ugu.com/sui/ugu/show?tip.today
==========================================================================
DISCLAIMER: All UNIX HOT TIPS ARE OWNED BY THE UNIX GURU UNIVERSE AND ARE
NOT TO BE SOLD, PRINTED OR USED WITHOUT THE WRITTEN CONSENT OF THE UNIX 
GURU UNIVERSE. ALL TIPS ARE "USE AT YOUR OWN RISK". UGU  ADVISES THAT 
ALL TIPS BE TESTED IN A NON-PRODUCTION DEVELOPMENT ENVIRONMENT FIRST.
Unix Guru Universe - www.ugu.com - tips at ugu.com - Copyright 1994-2001
==========================================================================
    
    
More information about the OLUG
mailing list