*BSD News Article 46743


Return to BSD News archive

Xref: sserve comp.unix.misc:17653 comp.unix.admin:30400 comp.unix.bsd:16678 comp.unix.programmer:26993 comp.unix.questions:66588 comp.unix.shell:23580
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:29 GMT
Organization: Hewlett Packard (CMS)
Lines: 12
Message-ID: <3tvvvp$m41@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