Re: [Guillem Jover] Parsing of dpkg status file considered harmful
Florent Rougon <f.rougon@free.fr> wrote:
>> Or simpler still, something like: fgrep $(echo -e "$file \n$file\t")
>> (I haven't checked the quoting, sorry.)
>
> Good idea, I had forgotten about this grep feature. I'm not sure,
> though, why you're trying to match '$file\t'. Have you actually seen
> tabs in the output of 'dpkg-query -W -f='${Conffiles}' <package>'?
I guess that's just the translation of our current [[:space:]].
> I haven't, and I don't expect the format to change (since the very
> purpose of dpkg-query seems to me to provide a parsable output for
> programs).
>
> Therefore, unless someone has good arguments, I'll use something like
> this:
>
> dpkg-query -W -f='${Conffiles}' "$package" \
> | grep -F " $file " | cut -d ' ' -f 3
I agree.
> NB: I use grep -F instead of fgrep because I read long ago on a GNU
> manpage (ISTR it was grep(1), but I cannot find it anymore) that
> 'grep -E' is preferred to egrep, 'grep -F' to fgrep, etc.
I guess on a Debian system it doesn't matter at all.
Regards, Frank
--
Frank Küster
Single Molecule Spectroscopy, Protein Folding @ Inst. f. Biochemie, Univ. Zürich
Debian Developer (teTeX/TeXLive)
Reply to: