*BSD News Article 46744


Return to BSD News archive

Xref: sserve comp.unix.misc:17654 comp.unix.admin:30401 comp.unix.bsd:16679 comp.unix.programmer:26994 comp.unix.questions:66589 comp.unix.shell:23581
Path: sserve!newshost.anu.edu.au!harbinger.cc.monash.edu.au!simtel!news.sprintlink.net!dish.news.pipex.net!pipex!uunet!in1.uu.net!news.datasrv.co.il!usenet
From: Tsachi Merin <tsachi@hpcms.co.il>
Newsgroups: comp.unix.misc,comp.unix.admin,comp.unix.bsd,comp.unix.programmer,comp.unix.questions,comp.unix.shell
Subject: Re: A Unix command to obtain directory name only
Date: 12 Jul 1995 08:09:31 GMT
Organization: Hewlett Packard (CMS)
Lines: 12
Message-ID: <3tvvvr$m48@israel-info.datasrv.co.il>
References: <3tk3dc$4ml@rcp6.elan.af.mil>
NNTP-Posting-Host: hpcms.hpcms.co.il
Mime-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
X-Mailer: Mozilla 1.1N (X11; I; HP-UX A.09.05 9000/715)
To: OHJ%CSCADPS@mhs.elan.af.mil
X-URL: news:3tk3dc$4ml@rcp6.elan.af.mil

Try:

ls -F1 /dir | grep '/'

-F ensures you get a '/' after each directory.
-1 ensures each one on a separate line (for the grep)

regards
Tsachi Merin
Tel Aviv
Israel