From: Tom Lane Date: Wed, 13 May 2026 16:07:19 +0000 (-0400) Subject: Use "grep -E" not "egrep". X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=2122281672b4505c6fa391899d8af2318770a102;p=thirdparty%2Fpostgresql.git Use "grep -E" not "egrep". "egrep" has never been in POSIX; the standard way to access this functionality is "grep -E". Recent versions of GNU grep have started to warn about this, so stop using "egrep". This could be back-patched, but I see little need to do so because the affected places are not code that runs during normal builds. (Perhaps src/backend/port/aix/mkldexport.sh is an exception, but let's wait to see if any AIX users complain before touching that.) Author: Tom Lane Reviewed-by: Peter Eisentraut Discussion: https://postgr.es/m/473272.1778685870@sss.pgh.pa.us --- diff --git a/doc/src/sgml/func/func-matching.sgml b/doc/src/sgml/func/func-matching.sgml index af60e9898de..ae1dff66722 100644 --- a/doc/src/sgml/func/func-matching.sgml +++ b/doc/src/sgml/func/func-matching.sgml @@ -505,7 +505,7 @@ substring('foobar' SIMILAR '#"o_b#"%' ESCAPE '#') NULLPOSIX regular expressions provide a more powerful means for pattern matching than the LIKE and SIMILAR TO operators. - Many Unix tools such as egrep, + Many Unix tools such as grep -E, sed, or awk use a pattern matching language that is similar to the one described here. @@ -1065,7 +1065,7 @@ regexp_substr('ABCDEFGHI', '(c..)(...)', 1, 1, 'i', 2) Regular expressions (REs), as defined in POSIX 1003.2, come in two forms: extended REs or EREs - (roughly those of egrep), and + (roughly those of grep -E), and basic REs or BREs (roughly those of ed). PostgreSQL supports both forms, and diff --git a/src/backend/port/aix/mkldexport.sh b/src/backend/port/aix/mkldexport.sh index 9d016e7afd5..366391bf01d 100755 --- a/src/backend/port/aix/mkldexport.sh +++ b/src/backend/port/aix/mkldexport.sh @@ -63,9 +63,9 @@ else fi fi $NM -BCg $1 | \ - egrep ' [TDB] ' | \ + grep ' [TDB] ' | \ sed -e 's/.* //' | \ - egrep -v '\$' | \ + grep -v '\$' | \ sed -e 's/^[.]//' | \ sort | \ uniq diff --git a/src/tools/find_typedef b/src/tools/find_typedef index 24e9b76651d..fec0520c32e 100755 --- a/src/tools/find_typedef +++ b/src/tools/find_typedef @@ -36,12 +36,12 @@ do # if objdump -W is recognized, only one line of error should appear if [ `objdump -W 2>&1 | wc -l` -eq 1 ] then # Linux objdump -W "$DIR"/* | - egrep -A3 '\(DW_TAG_typedef\)' | + grep -E -A3 '\(DW_TAG_typedef\)' | awk ' $2 == "DW_AT_name" {print $NF}' elif [ `readelf -w 2>&1 | wc -l` -gt 1 ] then # FreeBSD, similar output to Linux readelf -w "$DIR"/* | - egrep -A3 '\(DW_TAG_typedef\)' | + grep -E -A3 '\(DW_TAG_typedef\)' | awk ' $1 == "DW_AT_name" {print $NF}' fi done | @@ -50,4 +50,4 @@ sort | uniq | # these are used both for typedefs and variable names # so do not include them -egrep -v '^(date|interval|timestamp|ANY)$' +grep -E -v '^(date|interval|timestamp|ANY)$' diff --git a/src/tools/perlcheck/find_perl_files b/src/tools/perlcheck/find_perl_files index 20dceb800d0..406ec7f3a08 100644 --- a/src/tools/perlcheck/find_perl_files +++ b/src/tools/perlcheck/find_perl_files @@ -12,7 +12,7 @@ find_perl_files () { find "$@" -type f -name '*.p[lm]' -print # take executable files that file(1) thinks are perl files find "$@" -type f -perm -100 -exec file {} \; -print | - egrep -i ':.*perl[0-9]*\>' | + grep -E -i ':.*perl[0-9]*\>' | cut -d: -f1 } | sort -u | grep -v '^\./\.git/' }