156 Commits

Author SHA1 Message Date
Jim Meyering
03ec9a1080 maint: update copyright dates 2026-01-02 17:33:20 -08:00
Hans Ginzel
f1d0d1fd1d doc: correct two examples
* doc/sed.texi (Escaping Precedence): Expected output is "xbc", not
"Xbc" in each of two examples.
2025-07-09 15:09:30 -07:00
Arkadiusz Drabczyk
5e9ee78fac doc: correct sentence capitalization errors
* doc/sed.texi: As above.
2025-03-09 09:18:52 -07:00
Jim Meyering
0f74c04668 doc: correct a small falsehood
* doc/sed.texi (Zero Address): Also mention the FIRST~STEP
notation as a third case in which a zero address is valid.
Reported by Arkadiusz Drabczyk in
https://lists.gnu.org/r/sed-devel/2025-02/msg00008.html
2025-02-15 21:47:20 -08:00
Arkadiusz Drabczyk
253c89d9d6 doc: list all commands that have to be terminated by a newline
* doc/sed.texi (multiple sed commands): Mention that e, r, R, w and W
are like the a, c and i commands, in that one cannot terminate such
commands with a semicolon.
2025-02-04 20:10:51 -08:00
Jim Meyering
d3456f4482 maint: update all copyright dates via "make update-copyright" 2025-01-03 09:56:57 -08:00
Jim Meyering
2037812a6d maint: update copyright dates 2024-01-05 08:44:01 -08:00
Bruno Haible
5420e97c91 build: Ensure that makeinfo ≥ 6.8 checks the @menu structure.
See <https://lists.gnu.org/archive/html/bug-texinfo/2023-06/msg00015.html>.

* doc/local.mk (MAKEINFO): New variable.
* cfg.mk (_makefile_at_at_check_exceptions): New variable.
2023-06-24 18:38:02 -07:00
Paul Eggert
8c802c5078 maint: quote 'like this' not `like this' 2023-01-30 09:58:54 -08:00
Jim Meyering
d81710cc8d maint: update copyright dates 2023-01-01 17:19:34 -08:00
Jim Meyering
d1d7eeafe4 build: work when perl is installed but not in /usr/bin/perl
Also support building on systems without perl and when cross-compiling.
* configure.ac (AC_ARG_ENABLE [bold-man-page-references]): New
configure-time option, using code copied from coreutils.
(BUILD_MAN_PAGE, BUILD_DUMMY_MAN_PAGE): Remove definitions.
(HAVE_PERL): Remove bogus conditional.
* doc/dummy-man: New file, from coreutils, with slight adapation.
* build-aux/help2man: Update from coreutils.
* doc/local.mk (EXTRA_DIST): Distribute dummy-man.
(run_help2man): New variable.
(doc/sed.1): Use it rather than simply invoking help2man.
Simplify to use only one copy of this rule, now that run_help2man
works both with and without perl and when cross-compiling.
Move the --name=... string argument into...
* doc/sed.x: ... here. Also make the "Synopsis" appear in generated file.
In https://lists.gnu.org/r/sed-devel/2022-10/msg00005.html,
Bruno Haible reported build failure with perl in a different
location and (in another report) another failure with no perl at all.
2022-10-16 22:13:11 -07:00
Paul Eggert
d120d7f586 maint: stop using fdl module
This is as per current Gnulib recommendations.
2022-07-02 17:06:39 -05:00
Jim Meyering
0c8d88bc61 maint: make update-copyright 2022-01-01 15:00:18 -08:00
Jim Meyering
e84505f123 doc: fix more typos
* doc/sed.texi: Fix typos.
2021-10-02 07:58:40 -07:00
Antonio Diaz Diaz
6da11f2e5c doc: fix a typo
* doc/sed.texi (sed regular expressions):
s/considrations/considerations/
This addresses https://bugs.gnu.org/50943
2021-10-02 07:58:20 -07:00
Jim Meyering
3c1b6314a7 maint: avoid new syntax-check failure
* doc/sed.texi: Split lines longer than 80.
2021-09-05 06:17:07 -07:00
Jim Meyering
4c90fc246a doc: tighten/clarify wording e.g., re "g" modifier
* doc/sed.texi: When declaring that an example replaces
all occurrences, use "g" and make the description more
precise.  Prompted by http://bugs.gnu.org/50361
Stop using "the word" when describing a match, to avoid the
implication of a connection with "word"-delimited (\b) matching.
Prefer to match "on lines ...", not "in lines".
2021-09-05 12:04:21 +02:00
Assaf Gordon
07c9c74c6b sed: allow '0rFILE' (insert FILE before the first line)
The 'r' command can be used with address zero, effectively prepending
a file to the beginning of the input file, e.g.:
    sed '0rA.TXT' B.TXT > C.TXT
is equivalent to:
    cat A.TXT B.TXT > C.TXT

With "sed -i", this allows safe in-place prepending of files.
A typical example would be adding a license header to multiple source
files:
    sed -i '0rLICENSE' *.c *.h
    find -iname '*.cpp' | xargs sed -i '0rLICENSE'

A current cumbersome alternative is:
    sed -i -e 'x;${p;x};1rA.TXT' -e '1d'  B.TXT

* NEWS: Mention new feature.
* sed/sed.h (struct readcmd): New struct. (struct sed_cmd): Use new
struct instead of a char* for the filename.
* sed/compile.c (compile_program): Expand conditional detecting invalid
usage of "0" address to allow "0r"; Adjust '0r' to '1r' with prepending
(instead of appending).
* sed/execute.c (execute_program): 'r' command: support prepending.
* sed/debug.c (debug_print_function): Use the new 'struct readcmd'.
* testsuite/cmd-0r.sh: New test.
* testsuite/local.mk (TESTS): Add new test.
* doc/sed.texi (Zero Address): New section. (Adding a header to multiple
files): New example section.
2021-08-16 12:34:20 -06:00
Renaud Pacalet
268c0083de doc: fix wording in 'line length adj.' example
Reported in https://bugs.gnu.org/49680 .

* doc/sed.texi: Fix wording, typo.
2021-08-04 15:02:56 -06:00
Assaf Gordon
71de42fd34 maint: update all copyright year number ranges
Run "make update-copyright" and then...
* gnulib: Update to latest with copyright year adjusted.
* bootstrap.conf (gnulib_modules): Remove getopt module, depracated in
https://git.savannah.gnu.org/cgit/gnulib.git/commit/?id=0abc38bd2a1398f0
* po/POTFILES.in: Remove getopt.c
* sed/utils.h (panic): Rename _GL_ATTRIBUTE_FORMAT_PRINTF to
_GL_ATTRIBUTE_FORMAT_PRINTF_STANDARD following gnulib's change:
https://git.savannah.gnu.org/cgit/gnulib.git/commit/?id=387d654cabd7bc15
* tests/init.sh: Sync with gnulib to pick up copyright year.
* bootstrap: Likewise.
2021-01-05 17:02:10 -07:00
Jim Meyering
623f5cd2f9 maint: update all copyright year number ranges
Run "make update-copyright" and then...
* gnulib: Update to latest with copyright year adjusted.
* tests/init.sh: Sync with gnulib to pick up copyright year.
* bootstrap: Likewise.
2020-01-01 11:38:46 -08:00
Assaf Gordon
07df2c2e61 maint: update copyright dates for 2019
* all files: Run "make update-copyright".
2019-01-01 14:46:27 -07:00
Assaf Gordon
3ac640ce3b sed: add --debug feature
$ seq 3 | sed --debug -e 's/./--&--/ ; 2d'
    SED PROGRAM:
      s/./--&--/
      2 d
    INPUT:   'STDIN' line 1
    PATTERN: 1
    COMMAND: s/./--&--/
    MATCHED REGEX REGISTERS
      regex[0] = 0-1 '1'
    PATTERN: --1--
    COMMAND: 2 d
    END-OF-CYCLE:
    --1--
    INPUT:   'STDIN' line 2
    PATTERN: 2
    COMMAND: s/./--&--/
    MATCHED REGEX REGISTERS
      regex[0] = 0-1 '2'
    PATTERN: --2--
    COMMAND: 2 d
    END-OF-CYCLE:
    INPUT:   'STDIN' line 3
    PATTERN: 3
    COMMAND: s/./--&--/
    MATCHED REGEX REGISTERS
      regex[0] = 0-1 '3'
    PATTERN: --3--
    COMMAND: 2 d
    END-OF-CYCLE:
    --3--

Discussed in https://lists.gnu.org/r/sed-devel/2018-07/msg00006.html
and https://lists.gnu.org/r/sed-devel/2018-10/msg00007.html .

* NEWS: Mention new option.
* doc/sed.texi (Program options): Mention new option.
* sed/debug.c: New unit with debug printing functions.
* sed/sed.h (debug_print_command, debug_print_char, debug_print_program,
debug): Declare functions and global variable.
(struct sed_cmd): Add label_name member variable.
* sed/compile.c (compile_program): Save the label's name.
(cleanup_program_filenames): extracted function to free filenames.
(check_final_program) Don't delete the filenames, instead move it to ...
(finish_program) ... here.
* sed/execute.c (debug_print_end_of_cycle, debug_print_input,
debug_print_line): New debug functions (cannot be defined in debug.c as
execute's structures are private).
(execute_program, process_files): Call debug functions.
* sed/sed.c: (DEBUG_OPTION): New option for getoptlong.
(debug): New global variable.
(usage): Mention new option.
(main): Process new option and call debug functions if needed.
* testsuite/debug.pl: New tests.
* testsuite/local.mk (T): Add new tests.
2018-10-24 14:00:23 -06:00
Clint Adams
8e52c0aff0 doc: use @key{TAB} in texinfo
Discussed in https://bugs.gnu.org/22636 .

* doc/sed.texi: Use '@kbd{@key{TAB}}' instead of '@kbd{tab}' to improve
rendering in HTML and info formats.
Copyright-paperwork-exempt: Yes
2018-10-12 11:45:56 -06:00
Bjarni Ingi Gislason
19089418c6 doc: sed.x: some formatting corrections
Reported in https://bugs.gnu.org/30479 .

doc/sed.x: Change a HYPHEN-MINUS (code 0x55, 2D) to a dash (\-, minus)
if it matches " -[:alpha:]" or \(aq-[:alpha:] (for options); Use a pronoun
instead of a repeated noun.
Copyright-paperwork-exempt: Yes
2018-10-12 11:45:56 -06:00
Assaf Gordon
50f598b6a4 sed: update authors
* sed/sed.c (AUTHORS): Update.
* doc/sed.texi (@author): Update.
2018-10-12 11:35:07 -06:00
Jim Meyering
7c6a618904 doc: insert two missing words
doc/sed.texi (BRE vs ERE): Insert "with a".
2018-08-07 03:32:28 -07:00
Bernhard Voelker
a847466684 doc: tiny fix
* doc/sed.texi (Regexp Addresses): Remove the word 'two': there are
3 examples following.
2018-07-25 10:45:16 -06:00
Jim Meyering
41e506e12b doc: small improvements
* doc/sed.texi: s/only accepts/accepts only/.
(BRE vs ERE): Tweak ERE and BRE definitions, and convert a
passive-voice sentence to active voice.  Insert a comma.
2018-02-15 17:41:20 -07:00
Assaf Gordon
cb6cb45fed doc: change URLs to https
* doc/config.texi, doc/sed-dummy.1, doc/sed.texi: Change http to https for
GNU URLs. External links (e.g. sed.sf.net, autsingroup.org) currently do
not support https and kept as-is.
2018-02-13 16:07:29 -07:00
Assaf Gordon
a2daab7fb1 maint: change http to https in license headers
* all files: Change http to https for all licenses URL.
2018-02-13 16:02:12 -07:00
Assaf Gordon
4d4c0d5ad0 maint: update gnulib and copyright dates for 2018
* gnulib: Update to latest.
* all files: Run "make update-copyright".
2018-01-02 13:56:16 -07:00
Assaf Gordon
490b4997fe doc: fix incorrect line-wrapping example
Reported by Bamber Ward in https://bugs.gnu.org/28140 .

* doc/sed.texi (Line length adjustment): Fix sed script;
  Rewrite example to long script with inlined comments;
  Remove second example.
2017-10-28 21:24:42 -06:00
Assaf Gordon
9f99a4f51e doc: fix missing slash in example
Reported by Nick Chambers in https://bugs.gnu.org/28881 .

* doc/sed.texi (Invoking sed::overview): Add missing slash in
's/hello/world/' command.
2017-10-17 16:48:49 -06:00
Jim Meyering
a59fb8826a maint: stop using @acronym{...} in texinfo sources
* doc/sed.texi, doc/config.texi: Remove all uses of @acronym{...},
per recommendation by Karl Berry.
* cfg.mk (local-checks-to-skip): Remove exemption, enabling
the @acronym{-prohibiting syntax-check rule.
2017-05-13 18:42:21 -07:00
Assaf Gordon
05800ee0b7 doc: expand "locale considerations" (multibyte) section
Show examples of processing valid and invalid characters.
Mention \L,\U for s/// command.
Combines reports from:
 https://bugs.debian.org/500501
 https://lists.gnu.org/archive/html/coreutils/2017-02/msg00039.html

* doc/sed.texi (Locale Consideration): Expand section.
* doc/config.texi: Add variables to render unicode characters portably.
2017-03-08 01:06:01 +00:00
Assaf Gordon
a36e8abccc doc: warn against misuse of -i with other options
'sed -iE' is not the same as 'sed -Ei'. 'sed -ni' is dangerous.
From https://bugs.debian.org/832088

* doc/sed.texi (Command-Line Options): Explain and add examples
to '-i/--in-place' item.
2017-02-24 01:18:28 -05:00
Assaf Gordon
de6b6ccd74 doc: elaborate about regex matching on pattern space
Regex addresses work on current pattern space, not on the original
input lines. From https://bugs.debian.org/284646

* doc/sed.texi (Regexp Addresses): Add a paragraph and an example.
* doc/sed.x (Addresses): Add a sentence about regexp.
2017-02-24 00:49:20 -05:00
Assaf Gordon
a805d57e1f doc: mention escape-sequence precedence
Unescaping takes place before passing the pattern to the regex engine:
    $ echo 'a^c' | sed -e 's/\x5e/b/'
    ba^c

From: https://bugs.debian.org/605142

* doc/sed.texi (Escaping Precedence): Add new subsection under 'escape
sequences' with examples.
2017-02-24 00:22:51 -05:00
Alexandre Jasmin
1c6030213b doc: reference the i command in /regexp/I
Remove "TODO: add @code{pxref}" in the text and add the ref.

* doc/sed.texi (selecting lines by text matching): Add reference.
2017-02-09 23:00:35 -05:00
Alexandre Jasmin
45aae495cb doc: rework BRE/ERE table to fit PDF manual
Sample code in the basic/extended table was too wide to fit on a Letter
size printout. Text was overlapping and unreadable. Remove margin,
split commands in two lines and change the column with.

* doc/sed.texi (Basic and extended regexp): Rework table.
2017-02-09 23:00:35 -05:00
Alexandre Jasmin
5fbc15c812 doc: change description of the r command
"Reads text file a file" was probably a typo. Also remove "Example: " in
the summary as there's no example there.

* doc/sed.texi (sed scripts): Fix r command description.

Copyright-paperwork-exempt: Yes
2017-02-07 09:29:48 +00:00
Alexandre Jasmin
755e9434c0 doc: fix copy-pasted examples of regexp
The samples commands demonstrating '\B' and '\S' were both using '\w'.
The commands output is correct.

* doc/sed.texi (Regular Expression Extensions): Use the proper commands.

Copyright-paperwork-exempt: Yes
2017-02-07 09:28:04 +00:00
Assaf Gordon
61cf98dc1c doc: fix broken xref
Remove an extraneous space after @xref. Older 'makeinfo' would fail with:

  ./doc/sed.texi:3461: @xref expected braces.
  ./doc/sed.texi:3461: ` {Execution Cycle} and @ref{Addresses ov...' is
                         too long for expansion; not expanded.

Introduced in sed-4.3-15-gb0009b8.

* doc/sed.texi: Remove space after @xref.
2017-02-03 02:38:45 -05:00
Assaf Gordon
cca9795a71 doc: new 'multiple commands syntax' section
Explain which commands can be separated by semicolon and which require
newlines. Requested by Ori Avtalion in https://bugs.gnu.org/21845 .

* doc/sed.texi (Multiple commands syntax): New section in "sed scripts"
chapter.
2017-01-28 15:21:39 -05:00
Assaf Gordon
3365c939c8 doc: update 'other resources' chapter
Remove broken link and update other resources in the manual.
Reported by olszkocj@aol.com in https://bugs.gnu.org/24770 .

* doc/sed.texi (Other Resources): Update wording.
2017-01-24 22:23:23 -05:00
Assaf Gordon
b0009b8dd7 doc: add 'branching and flow control' section
* doc/sed.texi (Branching and flow control): New section under 'Advanced
Sed' chapter.
2017-01-17 00:11:25 -05:00
Assaf Gordon
8143a730f2 doc: add 'join lines' example
* doc/sed.texi (Joining lines): Add example of joining SMTP header
lines.
2017-01-17 00:11:25 -05:00
Jim Meyering
33e29e5863 maint: avoid syntax-check-exposed nit
* doc/local.mk (doc/sed.1): Use $(...) rather than @...@.
2017-01-16 14:36:00 -08:00
Assaf Gordon
a0a25e3ee3 build: skip building man page if needed
Skip building the man page if building from tarball (where 'doc/sed.1'
is already prebuilt). Build a stub if building from git but generating
the man page isn't possible (if there's no Perl or cross-compiling).
Cross-compilation issue reported by Vishal Biswas in
https://bugs.gnu.org/25358 .
Problematic 'perl' is related to https://bugs.gnu.org/25367 .

* configure.ac: Check for Perl, cross-compilation and tarball build;
Set automake variable BUILD_MAN_PAGE, BUILD_DUMMY_MAN_PAGE accordingly.
* doc/local.mk (doc/sed.1): Build conditionally if BUILD_MAN_PAGE is true;
Create a dummy man page if BUILD_DUMMY_MAN_PAGE is true.
* doc/sed-dummy.1: Stub man page.
2017-01-09 22:24:07 -05:00