*BSD News Article 74743


Return to BSD News archive

Path: euryale.cc.adfa.oz.au!newshost.anu.edu.au!harbinger.cc.monash.edu.au!munnari.OZ.AU!spool.mu.edu!news.sgi.com!swrinde!howland.reston.ans.net!newsxfer.itd.umich.edu!aanews.merit.net!server3.mich.com!not-for-mail
From: jakkanen@server2.mich.com (Jukka Akkanen)
Newsgroups: comp.unix.bsd.freebsd.misc
Subject: Re: sh command shell script writing. i'm stuck
Date: 26 Jul 1996 09:43:53 -0400
Organization: Optera Systems, Detroit, Michigan
Lines: 9
Message-ID: <4tai2p$h37@server2.mich.com>
References: <4t02d1$nec@cliff.island.net> <4t10n3$7bn@uriah.heep.sax.de>
NNTP-Posting-Host: server2.mich.com

In article <4t10n3$7bn@uriah.heep.sax.de>,
J Wunsch <joerg_wunsch@uriah.heep.sax.de> wrote:
>	tempuser=$(ls /home | awk 'NR == '$counter' {print; exit}')

You really can't beat sed with this particular task.  How about:

    tempuser=$(ls /home | sed -n ${counter}p)

-Jukka