[root@blindtoadstout jkinney]# find / -maxdepth 2 |head -n10<br>/<br>/.smolt<br>/.smolt/uuiddb.cfg<br>/sys<br>/sys/fs<br>/sys/devices<br>/sys/dev<br>/sys/bus<br>/sys/class<br>/sys/firmware<br>[root@blindtoadstout jkinney]# find / -maxdepth 2 |head -n10 | sed 's|^/.\+/|/|'<br>
/<br>/.smolt<br>/uuiddb.cfg<br>/sys<br>/fs<br>/devices<br>/dev<br>/bus<br>/class<br>/firmware<br><br><br>OK. So the sed regex need a tweak to dump leading paths that begin with a '.'<br><br>[root@blindtoadstout jkinney]# find / -maxdepth 2 |head -n10 | sed 's|^/[.]\?\.*.\+/|/|'<br>
/<br>/.smolt<br>/uuiddb.cfg<br>/sys<br>/fs<br>/devices<br>/dev<br>/bus<br>/class<br>/firmware<br><br><br>Better. But it still doesn't just dump lines that are only one directory deep like /sys and /.smolt<br><br>That has me stumped. Seems like a alternation expression like<br>
<br>find / -maxdepth 2 |head -n10 | sed 's:^/[.]\?\.*.\+(/|\$):/:'<br>should work by matching on either a / or a line ending which would render a top level dir to appear as just /, but it fails to do as expected.<br>
<br><div class="gmail_quote">On Sun, Sep 19, 2010 at 3:46 PM, Richard Bronosky <span dir="ltr"><<a href="mailto:Richard@bronosky.com">Richard@bronosky.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;">
Could someone please give me a transcript proof of this in action?<br>
(complete with mkdir /tmp/sample and touch ...) I really want to<br>
understand how that could possibly work. Each week I spend hours on<br>
irc://<a href="http://chat.freenode.net#bash" target="_blank">chat.freenode.net#bash</a> helping people with this exact kind of<br>
task. I'm not easily stumped. Especially not by a sed less than 60<br>
characters.<br>
<div><div></div><div class="h5"><br>
On 9/19/10, Jim Lynch <<a href="mailto:ale_nospam@fayettedigital.com">ale_nospam@fayettedigital.com</a>> wrote:<br>
> I did a find . | sed 's!^/.\+/!/!'<br>
><br>
> And it produced the output I was looking for. I didn't investigate it<br>
> any further.<br>
><br>
> Thanks,<br>
> Jim.<br>
> On 09/18/2010 06:39 PM, Richard Bronosky wrote:<br>
>> I have no idea how that solves the need you explained. I write sed and<br>
>> awk everyday. I have no idea how a substitution (the s in that sed<br>
>> script) could ever work to "generate a list of files in a directory,<br>
>> excluding the top level hidden directories and files." I can only<br>
>> imagine doing this with the d command like so:<br>
>> find . | sed '/^\.\/\./d'<br>
>><br>
>> On Sat, Sep 18, 2010 at 4:32 PM, Jim Lynch<br>
>> <<a href="mailto:ale_nospam@fayettedigital.com">ale_nospam@fayettedigital.com</a>> wrote:<br>
>><br>
>>> On 09/18/2010 04:02 PM, Jim Kinney wrote:<br>
>>><br>
>>>> sed 's!^/.\+/!/!'<br>
>>>><br>
>>> That works, thanks.<br>
>>><br>
>>> Jim.<br>
>>> _______________________________________________<br>
>>> Ale mailing list<br>
>>> <a href="mailto:Ale@ale.org">Ale@ale.org</a><br>
>>> <a href="http://mail.ale.org/mailman/listinfo/ale" target="_blank">http://mail.ale.org/mailman/listinfo/ale</a><br>
>>> See JOBS, ANNOUNCE and SCHOOLS lists at<br>
>>> <a href="http://mail.ale.org/mailman/listinfo" target="_blank">http://mail.ale.org/mailman/listinfo</a><br>
>>><br>
>>><br>
>><br>
>><br>
>><br>
><br>
> _______________________________________________<br>
> Ale mailing list<br>
> <a href="mailto:Ale@ale.org">Ale@ale.org</a><br>
> <a href="http://mail.ale.org/mailman/listinfo/ale" target="_blank">http://mail.ale.org/mailman/listinfo/ale</a><br>
> See JOBS, ANNOUNCE and SCHOOLS lists at<br>
> <a href="http://mail.ale.org/mailman/listinfo" target="_blank">http://mail.ale.org/mailman/listinfo</a><br>
><br>
<br>
</div></div><font color="#888888">--<br>
Sent from my mobile device<br>
<br>
.!# RichardBronosky #!.<br>
</font><div><div></div><div class="h5">_______________________________________________<br>
Ale mailing list<br>
<a href="mailto:Ale@ale.org">Ale@ale.org</a><br>
<a href="http://mail.ale.org/mailman/listinfo/ale" target="_blank">http://mail.ale.org/mailman/listinfo/ale</a><br>
See JOBS, ANNOUNCE and SCHOOLS lists at<br>
<a href="http://mail.ale.org/mailman/listinfo" target="_blank">http://mail.ale.org/mailman/listinfo</a><br>
</div></div></blockquote></div><br><br clear="all"><br>-- <br>-- <br>James P. Kinney III<br>I would rather stumble along in freedom than walk effortlessly in chains.<br><br><br>