[Eug-lug] To Horst-Q/colours

larry price laprice at gmail.com
Tue Jan 4 07:01:03 PST 2005


Well, it's only useful if you are needing to copy a set of symlinks
from one directory to another, the real value comes in knowing the
basic parts and combining them to do useful things on the spur of the
moment.

for instance the incantation I used can be broken down into it's
components like so

1. find searches  a given directory for files that are links and runs
ls -l on them to get the full file names of both the link and it's
target,

2. it's output is piped to sed, line by line, and for each line a
regular expression is used to write a line 'ln -s target linkname'

3. this is saved in a file named tmp which is then evaluated, and then erased.

the final effect of all this is to make a copy of every symbolic link
in one directory in another directory. while writing this post, I
realized it woul be possible to simplify the regex even further by
using an invocation of ln that only used the target

On Tue, 04 Jan 2005 12:07:33 +0000, walter fry <kd7kpa at hotmail.com> wrote:
> I have pencil on paper copied this command string and thought it wiser to
> ask whether this might be destructive if I entered this as is...is it ok to
> use?
> 
> >From: "T. Joseph CARTER" <knghtbrd at bluecherry.net>
> >Reply-To: Eugene Unix and Gnu/Linux User Group <euglug at euglug.org>
> >To: larry price <laprice at gmail.com>,Eugene Unix and Gnu/Linux User Group
> ><euglug at euglug.org>
> >Subject: Re: [Eug-lug] To Horst-Q/colours
> >Date: Mon, 3 Jan 2005 23:20:55 -0800
> >
> >On Tue, Jan 04, 2005 at 12:56:22AM -0500, larry price wrote:
> > > On Mon, 3 Jan 2005 21:17:38 -0800, T. Joseph CARTER
> > > <knghtbrd at bluecherry.net> wrote:
> > > > They say Linux is free if your time has no value.  For the time
> >invested,
> > > > though, you learn about a set of tools that are largely the same ones
> >that
> > > > were developed 35 years ago for getting serious work done, and are
> >still
> > > > some of the most effective tools for that purpose.  The UNIX shell
> > > > environment is at times a scary thing for new users, but once you get
> >the
> > > > hang of it and how easily you can do most anything you want with it, I
> > > > think you'll be hard pressed to imagine anything else as worthwhile,
> >even
> > > > if it does seem simpler for the time being.
> > >
> > > Keep at it, and you might find yourself doing things like this
> > >
> > > find /usr/blah/ -type l -exec ls -l {} \; | sed 's/^.* \([^ ].*\) ->
> > > \(.*\)/ln -s \2 \/usr\/foo\/\1' > tmp; eval tmp; rm tmp
> > >
> > > I actually used something like that earlier today, it made sense in
> >context.
> >
> >You're missing a / there before > tmp, and that's disgusting(!) and
> >clever.  ;)
> >
> >_______________________________________________
> >EUGLUG mailing list
> >euglug at euglug.org
> >http://www.euglug.org/mailman/listinfo/euglug
> 
> _________________________________________________________________
> On the road to retirement? Check out MSN Life Events for advice on how to
> get there! http://lifeevents.msn.com/category.aspx?cid=Retirement
> 
> _______________________________________________
> EUGLUG mailing list
> euglug at euglug.org
> http://www.euglug.org/mailman/listinfo/euglug
> 


-- 
http://Zoneverte.org -- information explained
Do you know what your IT infrastructure does?


More information about the EUGLUG mailing list