From unknown Fri Sep 12 10:41:37 2025 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-Mailer: MIME-tools 5.509 (Entity 5.509) Content-Type: text/plain; charset=utf-8 From: bug#56764 <56764@debbugs.gnu.org> To: bug#56764 <56764@debbugs.gnu.org> Subject: Status: Sed man page omits 'g' flag for substitute command Reply-To: bug#56764 <56764@debbugs.gnu.org> Date: Fri, 12 Sep 2025 17:41:37 +0000 retitle 56764 Sed man page omits 'g' flag for substitute command reassign 56764 sed submitter 56764 Tom Ekberg severity 56764 normal thanks From debbugs-submit-bounces@debbugs.gnu.org Mon Jul 25 14:08:04 2022 Received: (at submit) by debbugs.gnu.org; 25 Jul 2022 18:08:04 +0000 Received: from localhost ([127.0.0.1]:51467 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1oG2Ut-00078c-US for submit@debbugs.gnu.org; Mon, 25 Jul 2022 14:08:04 -0400 Received: from lists.gnu.org ([209.51.188.17]:33284) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1oG1UB-00057h-Nh for submit@debbugs.gnu.org; Mon, 25 Jul 2022 13:03:18 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:34178) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oG1UB-0002jv-DK for bug-sed@gnu.org; Mon, 25 Jul 2022 13:03:15 -0400 Received: from mx0a-00641c01.pphosted.com ([205.220.165.146]:5864) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oG1U8-0003f5-ON for bug-sed@gnu.org; Mon, 25 Jul 2022 13:03:15 -0400 Received: from pps.filterd (m0247471.ppops.net [127.0.0.1]) by mx0a-00641c01.pphosted.com (8.17.1.5/8.17.1.5) with ESMTP id 26PGHRfe020431 for ; Mon, 25 Jul 2022 17:03:08 GMT Received: from mxout24.cac.washington.edu (mxout24.cac.washington.edu [140.142.234.158]) by mx0a-00641c01.pphosted.com (PPS) with ESMTPS id 3hg9x6uya4-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT) for ; Mon, 25 Jul 2022 17:03:08 +0000 Received: from NAM11-CO1-obe.outbound.protection.outlook.com (mail-co1nam11lp2172.outbound.protection.outlook.com [104.47.56.172]) by mxout24.cac.washington.edu (8.14.4+UW20.07/8.14.4+UW22.04) with ESMTP id 26PH32fm009693 (version=TLSv1/SSLv3 cipher=AES256-GCM-SHA384 bits=256 verify=OK) for ; Mon, 25 Jul 2022 10:03:02 -0700 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=gQKADb8JvkLNQOm2WuorAPD9O6ubb95xhGV2x06Cf9aCgNJcMIfVq0kojSj1kn4biVpiU2E39lYeQ20Y6I9pKn0Fh3OboezOyA2hhW4QgL+Ra+H2QBvM3Y9EkbU+aKfbX5U8xbsu8HIg5PycSmY1gnxOUvhW1GeWksV/Oqt7sOctELiOyHmRkMMVtgLbqFDy0kc9C1n4s0sw/kFcl1MVLCnEjkfPN/mgVjXVbWITDehbZ6RZAFLQ4Im31zW/yqEXiTDBHf2ES+f+hPkl2zw1CSHRGchjepV1ZKqAE2B8khcjbAC6y+KaISqve8oCoksK04rt7i7P7K/lKm+BpdWpsA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=CKPnryfk8eodKUUzne0Ff9HuQaL50JoViYE3i12/mbQ=; b=QTC6ZbfMrPpV239L0XJLIBni4B+2yvy/PqDDM/1rogOhH1eQxv8H6W7pzt9WtHZtteictGco5DJUCprlZcd78bOwh2sFCjGRsapNaVseR5UrfgkSyT+J/tiQ1afvRJJavNKPictzQCgoSJOQvO1K5S797nMGz/OWEvFmQU7hfbGW0nulhTSdw+d4Q3anrzgfUndC3HcZcY6572RPsvLAO28I5221Oo8MjsPSy/j+ir49UbuWZCPmC4WeIdTkzcl5Nv+Czdwm+okcWvE3kcpqgjl8iX4KfQEfZivqVBxd27OBwaw8SkZMYbqy7oOlc0WFbprBi8Nt5+G8cyC+1BP7gw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=uw.edu; dmarc=pass action=none header.from=uw.edu; dkim=pass header.d=uw.edu; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=uwnetid.onmicrosoft.com; s=selector1-uwnetid-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=CKPnryfk8eodKUUzne0Ff9HuQaL50JoViYE3i12/mbQ=; b=Ym6dXitWVgWWtdgi4sri/vJOXAjuuOx9zodLIIwSuKiqueC2IvidNobekFRvasmOjMrfno04P57g0CramVU2s34mlvCgPvEZKGO0/8eSG5FbxDJfDWahdMeFnCVk+uzYN7XlTeLxOycbm28rzkBUJ8bSFaLEoraSsMb4gkMAViU= Received: from CO3PR08MB7957.namprd08.prod.outlook.com (2603:10b6:303:164::22) by BYAPR08MB4438.namprd08.prod.outlook.com (2603:10b6:a02:f2::29) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5458.24; Mon, 25 Jul 2022 17:02:55 +0000 Received: from CO3PR08MB7957.namprd08.prod.outlook.com ([fe80::f52e:db2d:1bf4:2df7]) by CO3PR08MB7957.namprd08.prod.outlook.com ([fe80::f52e:db2d:1bf4:2df7%3]) with mapi id 15.20.5458.024; Mon, 25 Jul 2022 17:02:55 +0000 From: Tom Ekberg To: "bug-sed@gnu.org" Subject: Sed man page omits 'g' flag for substitute command Thread-Topic: Sed man page omits 'g' flag for substitute command Thread-Index: AdigR7BRVYeFCRJGSbSdBsARMxikiA== Date: Mon, 25 Jul 2022 17:02:55 +0000 Message-ID: Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-ms-publictraffictype: Email x-ms-office365-filtering-correlation-id: 298deaea-5f1f-4f7d-fadb-08da6e5f84dc x-ms-traffictypediagnostic: BYAPR08MB4438:EE_ x-uw-exo-rulemarker: Beginning_StopProccessing_Rules x-uw-exo-last-ruleset: 6.1 x-uw-ex-1st-seen: ExO x-uw-exo-last-exlforwarded: false x-uw-exo-last-uwforwarded: false x-uw-exo-last-uwforwardedby: false x-uw-exo-1st-uwforwarded: false x-uw-exo-last-direction: Originating x-uw-exo-last-sender-realm: Inside x-uw-exo-last-recipentdomain: non-tracked x-uw-exo-last-check-uwash-spam: none x-uw-exo-last-scl-override: None x-uw-exo-last-deliverto: mxoutexch x-uw-exo-routed_to_mxoutexch: true x-ms-exchange-senderadcheck: 1 x-ms-exchange-antispam-relay: 0 x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: 48EKogNOfpfmsUlSXCS4FbkGRWx+b46Mebx+PrmkSjQSulb5UpIcsREEcJPmjmAyvXhZUN7iqXbX2sCsUYglXmh5X7R6D1hbZXSyhr3HXY1QtiYuR+MaGBFAT1dJLk+N7ErxfGZIjHKKfmum/SkqTJhmqFhrWUMP3XFNdLX4EqVPnm/hJQnCKMvKL9iMwRmgJeBJVzproZri2fjpucyDa2kDdYoPO6DNHnLprH8tUIagRThzUBJJ0WyEB+DuSB02VYo0eJyg/KoGsjrvEpJ9T4JIAb6lrWjXaKK8BUaD12oyV32gl6TgJ4Dd/HZPpwofH2O2JpS/cx8MiIaGCIcjpQ+lSYlEmxsT0+kNgS/f/GRnDt/IkvTwUOBLrHqJp0EZKNnCJeWrNyVbIGVPnJ0kJ1NM3CEpyiTsO/bvkO753/zJ2z/ytWwqomBjcGzfGWZfiecGTFQp05Z2NVD33xTIpe1Hc3BiaU5U72QZuDYQAMZiNVkcKjdXiIDq5xrxd/Yit7kBqm92KM3078Zjo5hoXOLrZNjtI2VTS0R8zbk/kjadQAEjrKKGDPkrycD7du76+8xq5/WtYqLCI/EMWALqZ23xD7eXYtuvupC7fNf/6iJRUmF1qmpBOSJeDDVWJWy67WMnbVwknjicyTimBQMxZriwx91AQM2OSDLH5RBAvib5GgZ9mJMt+bJthZWZoueIU3lfRtJY5iAeWJIhDOWN5lvFGqwn/4XG4FfPQwOqrDVa31jTPGEJyjqG3cm4g7vBrLBtPAj/Odqb9d8eLEOeazXD6bUES+rWl3+TlFf4RnJHSzmgydT8IdtswQGhwrzlfr65bqJdekDR8aCZREATtw== x-forefront-antispam-report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:CO3PR08MB7957.namprd08.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230016)(4636009)(136003)(346002)(366004)(376002)(396003)(39860400002)(71200400001)(316002)(55016003)(8676002)(76116006)(6916009)(186003)(6506007)(786003)(33656002)(7696005)(40140700001)(41320700001)(478600001)(38070700005)(86362001)(38100700002)(122000001)(166002)(5660300002)(2906002)(66556008)(19273905006)(66946007)(8936002)(64756008)(66446008)(52536014)(75432002)(26005)(9686003)(41300700001)(66476007); DIR:OUT; SFP:1101; x-ms-exchange-antispam-messagedata-chunkcount: 1 x-ms-exchange-antispam-messagedata-0: =?us-ascii?Q?WP9fvAleptE+P2lEmyNNUqjRwzZimh1wzkUaO0IrUEA+ldok9f1Omaoqzk5j?= =?us-ascii?Q?0hHM/1lto5Hs+lk8CW7EX3OJqXRJNl6fDrEb4WSI1jjFWFJZVJ+bQ+nZb/Os?= =?us-ascii?Q?6LJWix+k2/3yjQf7E51J5oIPVzt4aSQVqckgwwLbff6vBH1oPjnqbApRnlTO?= =?us-ascii?Q?ZiHVoAwIzxYogqKkxEWvx/okDMA/e5c99sWdkpTZmm1Sgq1aBKH1G6E9u0hu?= =?us-ascii?Q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IwQPaW/wmeKYeoxeU6dDyff+?= =?us-ascii?Q?axqaqwleS5FH4o2ptUipaOGQ+tfCagFtKjjqDVkq9GV0ICX4y5e+U7DxpK4H?= =?us-ascii?Q?Ff7wByUw3pqa2cz5q7wIqGa3W9L6+IMT2wuuIrZnWe3B9pRHW6W6tucszMJB?= =?us-ascii?Q?5AKA5skI8gavQi7vWi8FLelb030iVZfNsNfChvZwveuzdNdP/7rpRgtckdcn?= =?us-ascii?Q?lS+GrtkbuKymQfkWbf2GgB0AMcad4WBEf8TtfHpzQ5OewANQ4LLhU3gYhfd7?= =?us-ascii?Q?qD9mySUIFngcSlEUVVkosq22D3ze0xKm7HixAgM7l5AEYz+HtOc+lh6sGJJw?= =?us-ascii?Q?Phc6X7XC3/dpFweMt4oZR1r4IrBbL4eXg5S560dFtqvEYn8DFVUFlnjCObuJ?= =?us-ascii?Q?CevlmgimOSU85LwMMOgdzvyz8HkI4aPWgNhKqTHV3EmDanX+FlNl5RmloYtU?= =?us-ascii?Q?RN1vhmzFjbLEhm0bzac=3D?= Content-Type: multipart/alternative; boundary="_000_CO3PR08MB79575D1950B4219BFD11EF64CA959CO3PR08MB7957namp_" MIME-Version: 1.0 X-OriginatorOrg: uw.edu X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-AuthSource: CO3PR08MB7957.namprd08.prod.outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: 298deaea-5f1f-4f7d-fadb-08da6e5f84dc X-MS-Exchange-CrossTenant-originalarrivaltime: 25 Jul 2022 17:02:55.6213 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: f6b6dd5b-f02f-441a-99a0-162ac5060bd2 X-MS-Exchange-CrossTenant-mailboxtype: HOSTED X-MS-Exchange-CrossTenant-userprincipalname: SXricxaJlCaZ6BonYCXesFlr422fR7Doiq5BmoUXVx0Zf/UCVoCWKhsz0P01Vw39 X-MS-Exchange-Transport-CrossTenantHeadersStamped: BYAPR08MB4438 X-Proofpoint-ORIG-GUID: kkDTLNSFsRPKKlJ5E5gAtZiBiPUmYizc X-Proofpoint-GUID: kkDTLNSFsRPKKlJ5E5gAtZiBiPUmYizc X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.205,Aquarius:18.0.883,Hydra:6.0.517,FMLib:17.11.122.1 definitions=2022-07-25_12,2022-07-25_03,2022-06-22_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 impostorscore=0 bulkscore=0 mlxscore=0 malwarescore=0 spamscore=0 mlxlogscore=999 adultscore=0 lowpriorityscore=0 suspectscore=0 phishscore=0 clxscore=1011 priorityscore=1501 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2206140000 definitions=main-2207250070 Received-SPF: pass client-ip=205.220.165.146; envelope-from=tekberg@uw.edu; helo=mx0a-00641c01.pphosted.com X-Spam_score_int: -25 X-Spam_score: -2.6 X-Spam_bar: -- X-Spam_report: (-2.6 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, HTML_MESSAGE=0.001, RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_MSPIKE_H2=-0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-Spam-Score: -1.6 (-) X-Debbugs-Envelope-To: submit X-Mailman-Approved-At: Mon, 25 Jul 2022 14:08:01 -0400 X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -2.6 (--) --_000_CO3PR08MB79575D1950B4219BFD11EF64CA959CO3PR08MB7957namp_ Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable The sed man page has a synopsis for the substitute command (s) which is: s/regexp/replacement/ I have to go to the sed FAQ (http://sed.sourceforge.net/grabbag/tutorials/s= edfaq.txt), section 3.1.3, Substitution switches, to get a list of the poss= ible switches. While there are 8 switches I use 'g' most often to do a glob= al search/replace on the input line. Without this, only the first match is = replaced. The FAQ also describes the 'I' switch for doing a case-insensitiv= e search which may be useful in certain cases. The other 6 switches I have = never used: N (a number), p, w, M, S, and X. The version and date on the Ubuntu 20.04 sed man page is sed 4.7, December = 2018. The AIX V7.1 man page for sed does contain a description of the 's' s= witches (flags). Here is what that man page says about the 's' command: s/pattern/replacement/flags Substitutes the replacement string for the first occurrence of the pattern parameter in the pattern space. Any character that is displayed after the s subcommand can substitute for the / (slash) separator except for the space or new-line character. See the Pattern Matching section of the ed command. The value of the flags variable must be zero or more of: g Substitutes all non-overlapping instances of the pattern parameter rather than just the first one. n Substitutes for the n-th occurrence only of the pattern parameter. p Writes the pattern space to standard output if a replacement was made. w WFile Writes the pattern space to the WFile variable if a replacement was made. Appends the pattern space to the WFile variable. If the WFile variable was not already created by a previous write by this sed script, the sed command creates it. I was unable to find a version number on the AIX sed man page or the execut= able (cat /usr/bin/sed |strings -3|sort|uniq|less). That man page doesn't l= ist a -version or -V command line option. They don't work anyway. The sed man page should, when describing the 's' command, at least describe= the 'g' switch, and maybe also describe the 'I' switch. Tom Ekberg Senior Computer Specialist Department of Laboratory Medicine and Pathology 4th Floor, Pat Steel Building, currently WFH Home: (253) 561-2509 Email: tekberg@uw.edu --_000_CO3PR08MB79575D1950B4219BFD11EF64CA959CO3PR08MB7957namp_ Content-Type: text/html; charset="us-ascii" Content-Transfer-Encoding: quoted-printable

The sed man page ha= s a synopsis for the substitute command (s) which is:

 

s/regexp/replacemen= t/

 

I have to go to the= sed FAQ (http://sed.sourceforge.net/grabbag/tutorials/sedfaq.txt), section 3.= 1.3, Substitution switches, to get a list of the possible switches. While there are 8 switches I use ‘g’= most often to do a global search/replace on the input line. Without this, = only the first match is replaced. The FAQ also describes the ‘I’= ; switch for doing a case-insensitive search which may be useful in certain cases. The other 6 switches I have never used: N (a numb= er), p, w, M, S, and X.

 

The version and dat= e on the Ubuntu 20.04 sed man page is sed 4.7, December 2018. The AIX V7.1 = man page for sed does contain a description of the ‘s’ switches= (flags). Here is what that man page says about the ‘s’ command:

 

s/pattern/replaceme= nt/flags

    = Substitutes the replacement string for the first occurrence of the

    = pattern parameter in the pattern space. Any character that is

    = displayed after the s subcommand can substitute for the / (slash)

    = separator except for the space or new-line character.

 

    = See the Pattern Matching section of the ed command.

 

    = The value of the flags variable must be zero or more of:<= /p>

   &= nbsp;  g

   &= nbsp;    Substitutes all non-overlapping instances of the pa= ttern

   &= nbsp;    parameter rather than just the first one.

   &= nbsp;  n

   &= nbsp;    Substitutes for the n-th occurrence only of the pat= tern

   &= nbsp;    parameter.

   &= nbsp;  p

   &= nbsp;    Writes the pattern space to standard output if a

   &= nbsp;    replacement was made.

   &= nbsp;  w WFile

   &= nbsp;    Writes the pattern space to the WFile variable if a=

   &= nbsp;    replacement was made. Appends the pattern space to = the

   &= nbsp;    WFile variable. If the WFile variable was not alrea= dy

   &= nbsp;    created by a previous write by this sed script, the= sed

   &= nbsp;    command creates it.

 

I was unable to fin= d a version number on the AIX sed man page or the executable (cat /usr/bin/= sed |strings -3|sort|uniq|less). That man page doesn’t list a –= version or –V command line option. They don’t work anyway.

 

The sed man page sh= ould, when describing the ‘s’ command, at least describe the &#= 8216;g’ switch, and maybe also describe the ‘I’ switch.

 

Tom Ekberg
Senior Computer Specialist

Department of Laboratory= Medicine and Pathology
4th Floor, Pat Steel Building, currently WFH
Home: (253) 561-2509
Email: tekberg= @uw.edu

 

--_000_CO3PR08MB79575D1950B4219BFD11EF64CA959CO3PR08MB7957namp_--