[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: How to find dirs with single item



On Thu, 29 May 2014 22:43:29 +0100
Clive Standbridge <list-user@tgstandbridges.plus.com> wrote:

> find temp |sed 's|[^/]*$||' |sort |uniq -u

This doesn't work on this directory.

$ find cenovnici |sed 's|[^/]*$||' |sort |uniq -u

cenovnici/comtel_2011-12-20/Aktivna mre�
cenovnici/comtel_2011-12-20/Brand ra
cenovnici/comtel_2011-12-20/Ext.Aktivna Mre�
cenovnici/comtel_2011-12-20/Ext.Potro�
cenovnici/comtel_2011-12-20/Inkjet �tampa
cenovnici/comtel_2011-12-20/Ku�i�
cenovnici/comtel_2011-12-20/Laserski �tampa
cenovnici/comtel_2011-12-20/Mati�ne plo
cenovnici/comtel_2011-12-20/Memorijske kartice i �ita
cenovnici/comtel_2011-12-20/Mi�
cenovnici/comtel_2011-12-20/Pasivna mre�
cenovnici/comtel_2011-12-20/Potro�
cenovnici/comtel_2011-12-20/Potro�ni materijal za �tampa
cenovnici/comtel_2011-12-20/Zvu

First, it displays an empty line in place of base dir. This can be
solved by modified sed expression:

sed -n '2~1s|[^/]*$||p'

Second the lines are truncated:

$ ls -R1 cenovnici
cenovnici:
comtel.tar.bz2
comtel_2011-12-20

cenovnici/comtel_2011-12-20:
Aktivna mre?na oprema.html
Brand ra?unari.html
DVD,DivX i MP3,MP4  Player.html
DVD-RW.html
Digitalni aparati i kamere.html
Dodatna oprema za notebook.html
Ext.Aktivna Mre?na Oprema.html
Ext.Modemi.html
Ext.Multimedia.html
Ext.Potro?ni materijal.html
Fiksna telefonija.html
Game Controlleri & Konzole.html
Hard diskovi.html
Inkjet ?tampa?i.html
Kuleri.html
Ku?i?ta i Napajanja.html
Laserski ?tampa?i.html
Mati?ne plo?e.html
Medije (CD,Diskete,ZIP).html
Memorije.html
Memorijske kartice i ?ita?i.html
Mi?evi.html
Monitori.html
Multimedia.html
Notebook.html
Pasivna mre?na oprema.html
Potro?ni materijal za ?tampa?.html
Potro?ni materijal.html
Procesori.html
Projektori i oprema.html
Softver.html
Tastature.html
UPS.html
USB Memorije.html
Video kartice.html
Zvu?nici.html

"?" is in place of character codes which correcspond to
ex-Yugoslav-specific latin characters in cp1250 encoding and lines are
truncated before or after such character, but apparently not always so
this is really strange for me.

-- 
http://markorandjelovic.hopto.org

Please make your donation for humanitarian aid for flood victims in
Serbia: http://www.floodrelief.gov.rs/eng/


Reply to: