Commit Graph
121 Commits
Author SHA1 Message Date
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
Jim Meyering 1ceaa652a5 maint: update gnulib and copyright dates for 2017
* gnulib: Update to latest.
* all files: Run "make update-copyright".
2017-01-01 03:17:39 -08:00
Assaf Gordon 5a77cbf29a doc: new annotated example for N/P/D/b commands
Illustrates how to restructure line breaks over multiple lines.

* doc/sed.texi (Line length adjustment): New section.
2016-12-28 22:33:02 -05:00
Assaf Gordon aed5e43919 doc: new annotated example section for N/D commands
Illustrate how to use N/D to search for doubled-word spanning
multiple lines.

* doc/sed.texi (Text search across mutliple lines): New section.
2016-12-28 22:33:02 -05:00
Assaf Gordon 1d57c105e6 doc: add 'multiline techniques' section
Expand on using D,G,H,N,P commands to process multiple lines.

* doc/sed.texi (Multiline techniques): New section.
2016-12-28 21:26:28 -05:00
Jim Meyering 62f8375628 doc: fix sed.1-building rule to work on mingw
* doc/local.mk (doc/sed.1): Add $(EXEEXT) suffix on "sed/sed" dependent.
Patch by Miodrag Milanovic via Stephan T. Lavavej, in
https://lists.gnu.org/archive/html/sed-devel/2016-12/msg00026.html
2016-12-14 08:54:46 -08:00
Assaf Gordon adcc31c126 doc: simplify documentation building
Do not bother autogenerating sed.texi from sed-in.texi.  All it did
was to add a few '@group' commands.  Since these are rarely modified,
add them manually.  This simplifies the documentation-building rules
and lets us distribute only one copy of the texinfo manual.
See http://lists.gnu.org/archive/html/sed-devel/2016-12/msg00013.html

* doc/groupify.sed, doc/sed-in.texi: Remove files.
* doc/sed.texi: Remove the 'auto-generated' warning, as this file is no
longer auto-generated.
* doc/local.mk (doc_sed_TEXINFOS): Rename from sed_TEXINFOS.
(dist_noinst_DATA): The above renaming enables us to remove
doc/config.texi and doc/fdl.texi from this list.
(dist_noinst_SCRIPTS): Remove.
(doc/sed.texi): Remove rule.
(doc/s-texi): Likewise.
2016-12-10 21:48:34 -05:00
Assaf Gordon 77f32cf6c6 maint: add missing fdl.texi to distribution
Neglected to add it in commit v4.2.2-175-gc6a55aa.

* doc/local.mk (sed_TEXINFOS, dist_noinst_DATA): Add doc/fdl.texi.
2016-12-06 19:59:08 -05:00
Assaf Gordon 0989654f71 doc: follow-up changes for manual improvements
Fixes few missing issues from commit v4.2.2-176-g801a2c8,
discussed in
http://lists.gnu.org/archive/html/sed-devel/2016-12/msg00005.html

* doc/config.texi: Add stub texinfo macros '@codequotebacktick' and
'@codequoteundirected' (needed if using older versions of texinfo).
* doc/sed-in.texi: Fix syntax that's accepted by newer texinfo but
rejected by texinfo-4.13; Disable directed quote characters in examples.
* doc/sed.texi: Auto-regenerated.
2016-12-06 19:59:08 -05:00
Assaf Gordon 801a2c83b2 doc: reorganize and expand manual
Discussed in
http://lists.gnu.org/archive/html/sed-devel/2016-11/msg00005.html

* doc/sed-in.texi: Reorganize and expand.
* doc/sed.texi: Auto-regenerated.
2016-12-05 08:46:34 -05:00
Assaf Gordon c6a55aa201 maint: upgrade documentation license to GFDL-1.3 (or later)
* bootstrap.conf: Add gnulib's fdl module.
* doc/sed-in.texi: Update license blurb to latest recommended text.
Remove duplicated copyright information from title page (copied from
coreutil's texinfo style). Include fdl.texi in a new appendix.
2016-12-02 17:31:15 -05:00
Assaf Gordon 9796bdd2d6 sed: standardize exit code values
Use exit-code constants, and document them:
1=syntax error, 2=bad input files, 4=I/O error or panic.
Add "Exit Status" section in manual.

* sed/utils.h: Define new constants.
* sed/utils.c,
  sed/compile.c,
  sed/execute.c,
  sed/sed.c: Use constants instead of hard-coded values.
* doc/sed-in.texi: Add "Exit Status" section.
* doc/sed.texi: Automatically re-generated.
2016-11-04 21:29:51 -04:00
Assaf Gordon 50d2687936 maint: regenerate sed.texi after doc change
Regenerate sed.texi from sed-in.texi after
doc change in v4.2.2-160-10549b7 ( https://bugs.gnu.org/24799 ).

* doc/sed.texi: Regenerated with 'make info'.
2016-11-04 21:20:11 -04:00
Vincenzo Romano 10549b7e6d doc: make an example's description more precise
* doc/sed-in.texi (Regular Expressions): Mention that the match
must be at the end of a line.
2016-10-26 11:12:23 -07:00
Jim Meyering 639e80e8ee maint: address syntax-check warnings about @pxref
* doc/sed-in.texi: Improve cross-references.
* doc/sed.texi: Regenerate.
2016-10-02 15:52:14 -07:00
Assaf Gordon d8e71fe737 sed: new --sandbox option
In sandbox mode, r/w/e commands are not allowed.
This ensures sed operates only on files designated on the command line,
and cannot execute external programs.

* sed/sed.c (sandbox): New option variable.
  (usage): List new option.
  (main): Accept new option in getopt.
* sed/sed.h (sandbox): New extern option variable.
* sed/compile.c (DISALLOWED_CMD): New error message.
  (read_filename): Abort in sandbox mode (r/w commands).
  (compile_program): Abort on 'e' in sandbox mode.
* testsuite/sandbox.sh: Test new option.
* testsuite/local.mk: Add new test.
* NEWS: Mention new option.
* doc/sed-in.texi, doc/sed.texi: Document new option.
2016-09-05 00:27:04 -04:00
Jim Meyering 55b3353648 maint: fix distclean-vs-excess-.Po files more cleanly
* doc/local.mk (distclean-local): Remove rule.  Moved to ...
* Makefile.am (distclean-local): ...here, and add a command to
remove all .deps directories.  It could have stayed in that .mk
file, but since with this change, it is no longer specific to doc/,
the top level makes more sense.
* lib/local.mk (MOSTLYCLEANFILES): Remove this.  Covered by the above.
Reported by Assaf Gordon in
https://lists.gnu.org/archive/html/sed-devel/2016-08/msg00019.html
2016-08-27 23:03:37 -07:00
Jim Meyering 5ceaf1a059 doc: work with read-only sed.1
* doc/local.mk (doc/sed.1): Also remove $@, so that mv does not
prompt about read-only target.
2016-08-18 09:16:03 -07:00
Jim Meyering 5b44cd088a build: fix sed.1 dependency; work with latest automake
* doc/local.mk (doc/sed.1): Depend not on sed.c, but on the binary
that help2man must run.  Also depend on .version, to be sure we
pick up a version change.  Also, be careful not to write directly
to $@: instead write to $@-t, and make read-only to mark as generated,
and then, only if all is well, rename atomically to $@.
Also, prefix commands with $(AM_V_GEN) and $(AM_V_at) and ensure
that doc/ exists via $(MKDIR_P).
(distclean-local): New target. Use this instead of ...
(dist-hook-man-page): ... this. Remove rule.
(SEDBIN): Remove unnecessary $(top_builddir)/ prefix.
(doc/sed.texi, doc/s-texi): Remove some uses of $(top_builddir).
Replace others with $(srcdir).
* Makefile (dist-hook): remove dependency on dist-hook-man-page.
* lib/local.mk (MOSTLYCLEANFILES): Arrange for lib/.deps/*.Po
to be removed as part of "make distclean", so that make distcheck
no longer fails when using latest automake.
2016-08-14 22:36:15 -07:00
Assaf Gordon 1f2cb7cd3c doc: mention \s,\S,\<,\> regex gnu-extensions
* doc/sed-in.texi: Mention the extensions.
* doc/sed.texi: Automatically re-generated.
2016-08-11 23:51:58 -04:00
Assaf Gordon 6003a01f87 doc: expand on N command
* doc/sed-in.texi: Expand on gnu-extension of 'N' command.
* doc/sed.texi: Automatically re-generated.
2016-08-11 23:51:50 -04:00
Assaf Gordon 3b29bece3e build: switch to non-recursive makefile
* .gitignore: Ignore '.dirstamp' files
* bootstrap.conf: Add 'non-recursive-gnulib-prefix-hack' gnulib module.
  Add missing 'stdalign' module.
  (bootstrap_post_import_hook): Use module to adjust gnulib.mk file.
* configure.ac: Add 'subdir-objects' automake option, don't generate
  makefiles in subdirectories. Adjust path of XFAIL tests.
* Makefile.am: Include 'local.mk' files, adjust for non-recursive make.
* doc/Makefile.am: Rename to ...
* doc/local.mk: Adjust paths. Rename SED to
  SEDBIN variable, to avoid overriding the default system-wide SED value
  which is automatically set by autotools.
* lib/Makefile.am: Rename to ...
* lib/local.mk: Adjust paths.
* lib/.gitignore: Ignore 'stdalign.h' from gnulib module.
* sed/Makefile.am: Rename to ...
* sed/local.mk: Adjust paths.
* testsuite/Makefile.am: Rename to ...
* testsuite/local.mk: Adjust paths.
* testsuite/init.cfg: Move to ...
* init.cfg: ... here. Moved to avoid changing the path in init.sh, and to
  keep the same directory structure as coreutils.
  (require_en_utf8_locale_): Adjust path for get-mb-cur-max executable.
  (require_ja_shiftjis_locale_,require_valid_ja_shiftjis_locale_): Adjust
  path for test-mbrtowc executable.
* m4/.gitignore: Add gnulib's non-recusive-make module.
* testsuite/runtest: Adjust paths of Makefile.tests and dir variables,
  Skip utility program 'get-mb-cur-max' which is not a standalone test.
* testsuite/Makefile.tests: Adjust path of sed exeutable.
* testsuite/eval.sed, testsuite/eval.good: Adjust path of sed executable.
* testsuite/cmd-R.sh,
  testsuite/cmd-l.sh,
  testsuite/colon-with-no-label.sh,
  testsuite/comment-n.sh,
  testsuite/compile-errors.sh,
  testsuite/compile-tests.sh,
  testsuite/convert-number.sh,
  testsuite/execute-tests.sh,
  testsuite/follow-symlinks-stdin.sh,
  testsuite/follow-symlinks.sh,
  testsuite/help-version.sh,
  testsuite/in-place-hyphen.sh,
  testsuite/in-place-suffix-backup.sh,
  testsuite/invalid-mb-seq-UMR.sh,
  testsuite/mb-bad-delim.sh,
  testsuite/mb-charclass-non-utf8.sh,
  testsuite/mb-match-slash.sh,
  testsuite/mb-y-translate.sh,
  testsuite/normalize-text.sh,
  testsuite/nulldata.sh,
  testsuite/panic-tests.sh,
  testsuite/posix-char-class.sh,
  testsuite/posix-mode-N.sh,
  testsuite/posix-mode-addr.sh,
  testsuite/posix-mode-bad-ref.sh,
  testsuite/posix-mode-s.sh,
  testsuite/range-overlap.sh,
  testsuite/recursive-escape-c.sh,
  testsuite/regex-errors.sh,
  testsuite/stdin-prog.sh,
  testsuite/subst-mb-incomplete.sh,
  testsuite/subst-options.sh,
  testsuite/subst-replacement.sh,
  testsuite/temp-file-cleanup.sh,
  testsuite/unbuffered.sh: Adjust paths of init.sh, sed executable.
2016-07-24 22:22:53 -04:00
Jim Meyering 57f405ad56 maint: update copyright year, bootstrap, init.sh
Run "make update-copyright" and then...

* gnulib: Update to latest.
* tests/init.sh: Update from gnulib.
* bootstrap: Likewise.
2016-01-01 15:02:20 -08:00
Jim Meyering 857ed5c3b9 maint: enable sc_file_system
* cfg.mk (local-checks-to-skip): Remove its exemption.
* BUGS (characters): s/filesystem/file system/
* ChangeLog-2014 (setup_jump): Likewise.
* doc/sed-in.texi: Likewise.
* doc/sed.texi: Likewise.
2015-05-01 18:09:51 -07:00
Jim Meyering 96fe108e64 maint: enable sc_prohibit_long_lines
* cfg.mk (local-checks-to-skip): Remove the overall exemption,
but continue to exempt some files in testsuite/.
* configure.ac: Split a long line.
* doc/sed-in.texi: Split long lines.
* doc/sed.texi: Likewise.
* sed/compile.c: Likewise.
* sed/execute.c: Split long lines.
(execute_program): Reorder "#ifdef HAVE_POPEN" and
"if (pipe_fp != NULL)" if/else blocks to make the code
clearer and (incidentally) the lines shorter, due to a
decrease in nesting level.
* sed/sed.c: Split long lines.
* sed/utils.c: Likewise.
* sed/utils.h: Likewise.
2015-01-01 19:21:26 -08:00
Jim Meyering 082b25cc3e maint: update copyright year ranges to include 2015; update gnulib 2015-01-01 19:18:17 -08:00
Jim Meyering 6783c9f367 build: build-aux/texi2dvi: remove file
* build-aux/texi2dvi: Remove file. It was out of date and could
no longer parse our .texi files.
* Makefile.am (EXTRA_DIST): Don't list it here.
* cfg.mk: Remove an exemption for that file.
* doc/Makefile.am (TEXI2DVI): Remove definition.
2014-12-20 16:03:40 -08:00
Jim Meyering be2d5c0d33 remove support for the 'L' (fmt/flow-paragraph) command
* sed/Makefile.am (sed_SOURCES): Remove fmt.c.
* sed/execute.c (execute_program):
* sed/fmt.c: Remove file.
* sed/sed.h (fmt): Remove declaration.
* doc/sed.texi: Remove documentation for 'L' command.
* doc/sed-in.texi: Likewise.
* NEWS (Feature removal): Document it.
Prompted by the report from Jodie Cunningham that using this
command with a large number could cause sed to segfault:
https://bugs.launchpad.net/ubuntu/+source/sed/+bug/1400575
2014-12-16 15:40:57 -08:00
Jim Meyering 79c126b38e maint: enable sc_space_tab syntax check
* cfg.mk (local-checks-to-skip): Remove its exemption.
* doc/groupify.sed: Reverse SP-TAB sequences.
* sed/compile.c (compile_program): Remove spaces before TAB.
* sed/execute.c (append_replacement): Likewise.
2014-11-30 18:59:34 -08:00
Jim Meyering 5e695354a7 doc: remove doubled word
* doc/sed-in.texi: Remove doubled "the".
* doc/sed.texi: Likewise.
2014-11-30 18:59:33 -08:00
Jim Meyering b741f318d0 maint: do not version-control generated files.
* doc/sed.1: Remove.
* po/sed.pot: Likewise.
* po/Makevars: Likewise.
* .gitignore: Add their names.
2014-11-30 18:59:33 -08:00
Jim Meyering d15bafd704 maint: update copyright dates; use gnulib's update-copyright module
* bootstrap.conf (gnulib_modules): Add update-copyright.
Then, run "make update-copyright".
* Makefile.am: Add copyright header.
2014-11-30 18:59:32 -08:00
Jim Meyering d0c7a7dc82 maint: remove all trailing white space
First, run this command:
  git grep -l '	 $'|xargs perl -pi -e 's/[ \t]+$//'
Then some minor fix-up to make the two newly-failing tests
pass once again:
* testsuite/mac-mf.sed: Append this, s/ $//,
to eliminate trailing spaces in the actual output.
* testsuite/y-newline.good: Manually remove a trailing
space between two concatenated prompts.
2014-11-30 18:59:32 -08:00
Jim Meyering be11175d49 maint: correct failing "version" test
* configure.ac (COPYRIGHT_YEAR): Update to 2014, so
the "version" test passes once again.
* doc/sed.1: Also commit this auto-generated-yet-VC'd file.
2014-09-06 09:26:09 -07:00
Jose E. Marchesi 274476c861 Avoid a little potential misunderstanding in the Regular Expressions section of the manual.
2014-03-26  Jose E. Marchesi  <jemarch@gnu.org>

	* doc/sed.texi (Regular Expressions): avoid a potential
	misunderstanding in the description of the \| operator.
2014-03-26 20:39:56 +01:00
David A. Wheeler 8b65e07904 Modify documentation to note sed "-E" option, now in POSIX, for EREs.
2013-10-16  David A. Wheeler <dwheeler@dwheeler.com>

	* doc/sed-in.texi: Document "-E" option to use EREs.
	  GNU sed already supported "-E" as an undocumented synonym
	  for "-r", but "-E" is now in POSIX.
	  See: http://austingroupbugs.net/view.php?id=528.
	* doc/sed.1: Likewise.
	* doc/sed.texi: Likewise.
	* doc/sed.x: Likewise.
	* sed/sed.c: Likewise.
2013-10-17 12:46:30 +02:00