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

Re: sed question



On Wed, Mar 28, 2001 at 10:42:44PM -0600, klong@isis.protelco.net wrote:
> I need a sed invocation to extract quotes (") from around a string.
> 
> Basicly `cat /etc/bind/named.conf | grep zone | cut -d " " | sed $something'
> 
> to give me a list of zones I run bind for so I can:
> for zone in `$sedcsript`
> 	do
> 	$SOME $zone $MANAGENENT
> 	done
> 
> or if there is a better way......
> I get tired of hand editing....esp since I can't seem to remember cut&paste
> in vi

well, perl is a resource hog, but that's because it can do just
about anything, in eleven keystrokes... :)

but if you're determined to use smaller components, how about

	$zones = `grep ^zone < /etc/bind/named.conf | cut -f2 '-d"'`

	man cut

of course, you could use 'sed' if you absolutely felt obliged
to... :)

-- 
It is always hazardous to ask "Why?" in science, but it is often
interesting to do so just the same.
		-- Isaac Asimov, 'The Genetic Code'

will@serensoft.com
http://newbieDoc.sourceforge.net/ -- we need your brain!
http://www.dontUthink.com/ -- your brain needs us!



Reply to: