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

Re: OT: Which tool, and how, to get partial string from file?



Stefan O'Rear wrote:

On Fri, Aug 20, 2004 at 03:27:34PM -0500, Kent West wrote:
but what I want returned is just the word "programmer". I figure it's some switch to grep, or perhaps piping the results to sed or awk, but I'm unfamiliar with these tools, and an hour of trying to grok the man pages and web tutorials for these apps hasn't gotten me any closer to a solution. I'm hoping one of you whiz-guys can provide me an answer in about ten seconds.

Is this helpful:

stefan:~$ tr -cs '[a-zA-Z0-9-]' '\012' < /var/cache/debconf/templates.dat | grep ault-x-dis
default-x-display-manager
default-x-display-manager


IIUC, this is breaking each word of the file into its own line, which then gets grepped. Seems to work, but it seems a bit inelegant. However, if no one suggests anything better, I'll use it.

Thanks!

--
Kent





Reply to: