sm-discuss AT lists.ibiblio.org
Subject: Public SourceMage Discussion List
List archive
- From: Seth Alan Woolley <seth AT positivism.org>
- To: "Sergey A. Lipnevich" <sergey AT sourcemage.org>
- Cc: sm-discuss AT lists.ibiblio.org
- Subject: Re: [SM-Discuss] Regex type for filter files
- Date: Wed, 14 Dec 2005 11:49:44 -0800
I just looked at the source code, and libsorcery's filter() function on
line 443 of devel sorcery is using basic regular expressions:
#---------------------------------------------------------------------
## @param filename
## @Stdin list of files/dirs/..
## @Stdout filtered list
## First argument is a file that contains (basic) grep regular expressions.
## They are joined with \|'s and given to grep -v.
## Which will filter standard input to remove entries that match.
## Used to filter out excluded or protected files from install logs.
##
#---------------------------------------------------------------------
function filter() {
local thing RID_LIST
local files each invert
for each in $@; do
test -f $each && files="$files $each"
done
if [[ $files ]] ; then
RID_LIST=$(
cat $files | while read thing; do
echo -n "$thing\|"
done
echo -n /dev/null)
grep -v "$RID_LIST"
else
cat
fi
}
Hope that helps answer your question.
Note that older sorcerys used basic regex too, but they put in ^...$
automatically. Not sure when stable picked up the new format.
On Wed, Dec 14, 2005 at 02:30:43PM -0500, Sergey A. Lipnevich wrote:
> Hi,
>
> I have an RFC for filter files (volatiles, etc.). Which regex type
> should be used? For example, I use these commands to test before I add
> stuff to volatiles:
>
> $ find /usr/share/pear -regextype emacs -regex
> '^/usr/share/pear/\.\(filemap\|lock\)$'
> /usr/share/pear/.lock
> $ find /usr/share/pear -regextype posix-egrep -regex
> '^/usr/share/pear/\.(filemap|lock)$'
> /usr/share/pear/.lock
>
> The line after "-regex" is what goes into the filter. The first one is
> the default for `find', and the second one is obviously for `egrep.'
> I can also use two expressions instead of one (the first for `.filemap'
> file and the second for `.lock') and not require "extended" regex features.
> My question is, which syntax should be used?
> Thank you!
>
> Sergey.
> _______________________________________________
> SM-Discuss mailing list
> SM-Discuss AT lists.ibiblio.org
> http://lists.ibiblio.org/mailman/listinfo/sm-discuss
>
--
Seth Alan Woolley [seth at positivism.org], SPAM/UCE is unauthorized
Quality Assurance Team Leader & Security Team: Source Mage GNU/linux
Linux so advanced, it may as well be magic http://www.sourcemage.org
Key id 63C1E02F = E07A FB0E 5925 CE4A 6526 2AD5 1782 FEC2 63C1 E02F
Attachment:
pgpOic8qvIDq9.pgp
Description: PGP signature
-
[SM-Discuss] Regex type for filter files,
Sergey A. Lipnevich, 12/14/2005
-
Re: [SM-Discuss] Regex type for filter files,
Seth Alan Woolley, 12/14/2005
-
Re: [SM-Discuss] Regex type for filter files,
Sergey A. Lipnevich, 12/14/2005
- Re: [SM-Discuss] Regex type for filter files, Seth Alan Woolley, 12/14/2005
-
Re: [SM-Discuss] Regex type for filter files,
Sergey A. Lipnevich, 12/14/2005
-
Re: [SM-Discuss] Regex type for filter files,
Seth Alan Woolley, 12/14/2005
Archive powered by MHonArc 2.6.24.