[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Help-bash] bash suitable for parsing big files?
From: |
Greg Wooledge |
Subject: |
Re: [Help-bash] bash suitable for parsing big files? |
Date: |
Fri, 13 Sep 2013 08:11:33 -0400 |
User-agent: |
Mutt/1.4.2.3i |
On Fri, Sep 13, 2013 at 02:55:36AM +0000, adrelanos wrote:
> The script I am writing looks what files are installed, downloads the
> package from $linux-distribution's repositories and compares them with
> the ones on the disk.
On Fri, Sep 13, 2013 at 12:05:25AM +0000, adrelanos wrote:
> For those who don't know /var/lib/dpkg/status, it's size is roughly 2 MB
> and contains roughly 50.000 lines.
Ugh. Parsing /var/lib/dpkg/status is not the best approach at all.
while read -r pkg _; do
... process "$pkg" somehow ...
done < <(dpkg --get-selections)
>From the man page:
--get-selections [package-name-pattern...]
Get list of package selections, and write it to stdout. Without
a pattern, non-installed packages (i.e. those which have been
previously purged) will not be shown.
This saves you from having to write a finite state machine sort of thing
to parse the multiple-lines-per-package status file (which you would have
to do in order to filter out the non-installed ones).
- [Help-bash] bash suitable for parsing big files?, adrelanos, 2013/09/12
- Re: [Help-bash] bash suitable for parsing big files?, Dennis Williamson, 2013/09/12
- Re: [Help-bash] bash suitable for parsing big files?, adrelanos, 2013/09/12
- Re: [Help-bash] bash suitable for parsing big files?, Matthew Cengia, 2013/09/13
- Re: [Help-bash] bash suitable for parsing big files?, adrelanos, 2013/09/13
- Re: [Help-bash] bash suitable for parsing big files?, Matthew Cengia, 2013/09/13
- Re: [Help-bash] bash suitable for parsing big files?, Matthew Cengia, 2013/09/13
- Re: [Help-bash] bash suitable for parsing big files?, adrelanos, 2013/09/14
- Re: [Help-bash] bash suitable for parsing big files?, adrelanos, 2013/09/14
- Re: [Help-bash] bash suitable for parsing big files?, Chris Down, 2013/09/15
- Re: [Help-bash] bash suitable for parsing big files?,
Greg Wooledge <=
- Re: [Help-bash] bash suitable for parsing big files?, adrelanos, 2013/09/14
- Re: [Help-bash] bash suitable for parsing big files?, Chris Down, 2013/09/15
- Re: [Help-bash] bash suitable for parsing big files?, adrelanos, 2013/09/15
- Re: [Help-bash] bash suitable for parsing big files?, Chris Down, 2013/09/15
- Re: [Help-bash] bash suitable for parsing big files?, adrelanos, 2013/09/15
- Re: [Help-bash] bash suitable for parsing big files?, Chris Down, 2013/09/16