[Top][All Lists]

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

[gNewSense-users] Corrected script Re: Proposal regarding KFV data batch

From: Bake Timmons
Subject: [gNewSense-users] Corrected script Re: Proposal regarding KFV data batch handling
Date: Sat, 12 Jul 2008 22:12:52 -0400
User-agent: Gnus/5.11 (Gnus v5.11) Emacs/22.1 (gnu/linux)

Since Brian seems to want just a simple list for now, it now is
available at

The script that generated the list, filter-non-free-files, had a
problem related to sorting, so I ended up redoing it in bash and have
attached it.  Other than working properly, the other (very slight)
improvement is that no items in a directory are listed if the
directory itself is to be deleted (i.e., is 100% non-free).

I agree with Karl that it would be nice to convert the list to
hyperlinks, so just let me know, Brian, and I will do that.

#                              -*- Mode: Bash -*-
# Usage: filter-non-free-files [file of sorted path names]
# Given gNewSense KFV table source on standard input, print on
# standard output relative file paths corresponding to any table rows
# specifying non-free files.  Such table rows are converted to regular
# expressions that are matched against a special file of sorted,
# relative file paths.  A single optional argument can indicate the
# location of the special file, otherwise the default value is
# "all-file-paths".

# Here is an example of creating the special file:
# $ find linux-ubuntu-modules-2.6.24_16.23/ \
#       | sort -t/ -k1,1 -k2,2 -k3,3 -k4,4 -k5,5 -k6,6 -k7,7 -k8,8 -k9,9 \
#       > ~/kernel-files
# Here is an extended example of use:
# $ find /var/www/wiki.d/ -mtime -1 -type f -exec cat '{}' ';' \
#       | filter-non-free-files ~/kernel-files > to-remove-new
# $ rm -fr $(cat to-remove-new)
# $ touch removed \
#       && cp removed removed-old \
#       && sort --unique --merge removed-old to-remove-new > removed
# The "removed" file in this case is a record of removed files and
# could be included in a web page, for example.


if [[ $1 ]]; then

grep --only-matching 'linux.\+||0%||[^|]*|\?\(N\|Y\)[^/]' \
| sed -n -e 's/\([^|]\+\).\+/\1/' -e 's/--/\//g' -e 's/-/./gp' \
| sort -t/ -k1,1 -k2,2 -k3,3 -k4,4 -k5,5 -k6,6 -k7,7 -k8,8 -k9,9 \
| while read pattern; do
    while read -u 4 path && [[ ! ($path =~ $pattern) ]]; do
    if [[ $path && ! $path =~ $lastpath ]]; then
        echo $path
done 4<$filepaths

reply via email to

[Prev in Thread] Current Thread [Next in Thread]