A programmable line-oriented editor forked from GNU ed.
  • C 82.6%
  • R 10.7%
  • Makefile 3.5%
  • Shell 3.2%
Find a file
2026-04-05 03:34:54 +02:00
doc Rename ´ed´ doc/ files by ´ped´ 2026-04-03 20:17:04 -03:00
testsuite Initial commit 2026-04-03 11:24:47 -03:00
AUTHORS Initial commit 2026-04-03 11:24:47 -03:00
buffer.c Update docs, copyrights and licenses 2026-04-03 20:52:25 -03:00
carg_parser.c Clean if statements 2026-04-03 11:48:21 -03:00
carg_parser.h Initial commit 2026-04-03 11:24:47 -03:00
ChangeLog Initial commit 2026-04-03 11:24:47 -03:00
configure Update docs, copyrights and licenses 2026-04-03 20:52:25 -03:00
COPYING Initial commit 2026-04-03 11:24:47 -03:00
global.c Update docs, copyrights and licenses 2026-04-03 20:52:25 -03:00
INSTALL Initial commit 2026-04-03 11:24:47 -03:00
io.c Update docs, copyrights and licenses 2026-04-03 20:52:25 -03:00
LICENSE cp COPYING LICENSE 2026-04-03 11:28:12 -03:00
main.c Remove ´static ... program_year ...´ 2026-04-03 21:01:07 -03:00
main_loop.c Update docs, copyrights and licenses 2026-04-03 20:52:25 -03:00
Makefile.in Replace ´´ed.h´´ by ´´ped´´ in header inclusion 2026-04-03 20:20:08 -03:00
NEWS Initial commit 2026-04-03 11:24:47 -03:00
ped.h Update docs, copyrights and licenses 2026-04-03 20:52:25 -03:00
README Atualizar README 2026-04-05 03:34:54 +02:00
regex.c Update docs, copyrights and licenses 2026-04-03 20:52:25 -03:00
rped.in Rename red.in to rped.in 2026-04-03 20:59:08 -03:00
signal.c Update docs, copyrights and licenses 2026-04-03 20:52:25 -03:00

See the file INSTALL for compilation and installation instructions.

Description

ped is a programmable line-oriented text editor forked from GNU ed. It is used
to create, display, modify and otherwise manipulate text files, by
interactively, or by script files (even without pipes or any makeshift).
A restricted version of ped, rped, can only
edit files in the current directory and cannot execute shell commands.

Extensions to and deviations from the POSIX standard are described below.

Report bugs in "issues" section of ped Codeberg project page.

Ped home page: http://codeberg.org/agap/ped

For a description of the ped algorithm, see Brian W. Kernighan and
P. J. Plauger's book "Software Tools in Pascal", Addison-Wesley, 1981.

Ped uses Arg_parser for command-line argument parsing:
http://www.nongnu.org/arg-parser/arg_parser.html

ped(1) is not strictly POSIX compliant, as described in the
POSIX 1003.1-2004 document. The following is a summary of omissions and
extensions to, and deviations from, the POSIX standard.

EXTENSIONS
----------
  * Though ped is not a stream editor, it can be used to edit binary files.
    To assist in binary editing, when a file containing at least one ASCII
    NUL character is written, a newline is not appended if it did not
    already contain one upon reading. If the last line has been modified,
    reading an empty file, for example /dev/null, prior to writing prevents
    appending a newline to a binary file.

    For example, to create a file with ped containing a single NUL character:
      $ ped file
      a
      ^@
      .
      r /dev/null
      wq

    Similarly, to remove a newline from the end of binary 'file':
      $ ped file
      r /dev/null
      wq

  * BSD commands have been implemented wherever they do not conflict with
    the POSIX standard.  The BSD-ism's included are:
      * 's' (i.e., s[1-9rgp]*) to repeat a previous substitution,
      * 'W' for appending text to an existing file,
      * 'wq' for exiting after a write, and
      * 'z' for scrolling through the buffer.

  * The POSIX interactive global commands 'G' and 'V' are extended to
    support multiple commands, including 'a', 'c', and 'i'.  The command
    format is the same as for the global commands 'g' and 'v', i.e., one
    command per line with each line, except for the last, ending in a
    backslash (\).

  * For SunOS ed(1) compatibility, ped runs in restricted mode if invoked
    as rped.  This limits editing of files in the local directory only and
    prohibits shell commands.

DEVIATIONS
----------
  * To support the BSD 's' command (see EXTENSIONS above), substitution
    patterns cannot be delimited by the digits '1' to '9' or by the
    characters 'r', 'g' and 'p'. In contrast, POSIX specifies that any
    character except space and newline can be used as a delimiter.

  * Since the behavior of 'u' (undo) within a 'g' (global) command list is
    not specified by POSIX, ped follows the behavior of the SunOS ed:
    undo forces a global command list to be executed only once, rather than
    for each line matching a global pattern.  In addtion, each instance of
    'u' within a global command undoes all previous commands (including
    undo's) in the command list.  This seems the best way, since the
    alternatives are either too complicated to implement or too confusing
    to use.

  * The 'm' (move) command within a 'g' command list also follows the SunOS
    ed implementation: any lines moved are removed from the global command's
    'active' list.

  * For backwards compatibility, errors in piped scripts do not force ed
    to exit.  POSIX only specifies ed's response for input via regular
    files (including here documents) or tty's.


TESTSUITE
---------
The files in the 'testsuite' directory with extensions '.ed', '.r', and
'.err' are used for testing ed. To run the tests, configure the package and
type 'make check' from the build directory. The tests do not exhaustively
check POSIX compliance nor do they check correct 8-bit or long line support.

The test file extensions have the following meanings:
.ed   Ed script - a list of ed commands.
.r    Result - the expected output after processing data via an ed script.
.err  Error - invalid ed commands that should generate an error.

The output of the .ed scripts is written to files with .o extension and
compared with their corresponding .r result files. The .err scripts should
exit with nonzero status without altering the contents of the buffer.

If any test fails, the error messages look like:

	*** The script u.ed exited abnormally ***
or:
	*** Output u.o of script u.ed is incorrect ***


Copyright (C) 1993, 1994 Andrew L. Moore
Copyright (C) 2006-2025 Antonio Diaz Diaz.
Copyright (C) 2026 Gabriel Proença Alves

This file is free documentation: you have unlimited permission to copy,
distribute, and modify it.

The file Makefile.in is a data file used by configure to produce the Makefile.
It has the same copyright owner and permissions that configure itself.