Am 02. Dez, 2008 schwätzte Dazed_75 so:
moin moin,
> I know I could figure this out, and will tomorrow if no one gives me
> the answer in the next hour. I have a file with many mv xxx yyy
> commands and want to make another file with mv yyy xxx commands so
> just need to swap the arguments. I have to go do some things now and
> have a meeting tonight so would appreciate a reminder how to do this.
> I know it is trivial but just don't remember how right now. Thanks in
> advance.
This command presumes there are no spaces in xxx and yyy and that yyy is
the last thing on each command line. Adjust as necessary.
$ echo mv xxx yyy | sed -re 's/ ([^[:space:]]+) ([^[:space:]]+)$/ \2 \1/'
mv yyy xxx
You could also use cut and some variable assignments.
ciao,
der.hans
--
# http://www.LuftHans.com/ http://www.LuftHans.com/Classes/
# Passwords are like underwear. You don't share them, you don't hang them on
# your monitor, or under your keyboard, you don't email them, or put them on
# a web site, and you must change them very often. -- Unknown
---------------------------------------------------
PLUG-discuss mailing list -
PLUG-discuss@lists.plug.phoenix.az.us
To subscribe, unsubscribe, or to change your mail settings:
http://lists.PLUG.phoenix.az.us/mailman/listinfo/plug-discuss