Jump to content

Ex (text editor): Difference between revisions

From Wikipedia, the free encyclopedia
Content deleted Content added
AnomieBOT (talk | contribs)
m Dating maintenance tags: {{Cn}}
ce
 
(48 intermediate revisions by 35 users not shown)
Line 1: Line 1:
{{short description|Line editor for Unix systems}}
{{Unreferenced stub|auto=yes|date=December 2009}}
{{Refimprove|date=December 2012}}
{{Lowercase}}
{{Lowercase}}
{{Infobox software
'''ex''', short for EXtended, is a [[line editor]] for [[Unix]] systems originally written by [[William Joy]]<ref>http://ex-vi.sourceforge.net/ex.html</ref> and Chuck Haley.{{cn|date=August 2012}}
| name = ex
| author = [[Bill Joy]]
| released = {{Start date and age|1978|03|09}} (as part of 1BSD)
| programming language = [[C (programming language)|C]]
| operating system = [[Unix]]
| platform = [[Cross-platform]]
| genre = [[Text editor]]
}}
'''ex''', (short for ''extended''),<ref>[https://github.com/mhinz/vi-editor-history#ex vi editor history:ex]</ref><ref>{{Cite web |url=https://buildingvts.com/a-brief-history-of-vim-1476ec4a6eb8#694e |title=A Brief History of Vim:1976 |access-date=2021-06-05 |archive-date=2021-06-05 |archive-url=https://web.archive.org/web/20210605192840/https://buildingvts.com/a-brief-history-of-vim-1476ec4a6eb8#694e |url-status=dead }}</ref>{{better source|date=June 2021}} is a [[line editor]] for [[Unix]] systems originally written by [[Bill Joy]]<ref>[http://ex-vi.sourceforge.net/ex.html ex manual page]</ref> in 1976, beginning with an earlier program written by Charles Haley.<ref>William N. Joy, ''[http://roguelife.org/~fujita/COOKIES/HISTORY/1BSD/exrefm.pdf Ex reference manual]'', November, 1977</ref> Multiple implementations of the program exist; they are standardized by [[POSIX]].<ref>{{man|cu|ex|SUS}}</ref>


==History==
The original <code>ex</code> was an advanced version of the standard Unix editor [[ed (text editor)|ed]], included in the [[Berkeley Software Distribution]]. ex is similar to ed, with the exception that some switches and options are modified so that they are more [[user-friendly]].
The original Unix editor [[Ed (text editor)|ed]] was distributed with the [[Research Unix|Bell Labs versions]] of the operating system in the 1970s. George Coulouris of [[Queen Mary College]], London, which had installed Unix in 1973, developed an improved version called em in 1975 that could take advantage of [[Computer terminal#Early VDUs|video terminals]].<ref>[http://www.coulouris.net/cs_history/em_story/ George Coulouris: Bits of History]</ref> While visiting Berkeley, Coulouris presented his program to [[Bill Joy]], who modified it to be less demanding on the processor; Joy's version became ex<ref name="penguin">{{cite book |first=Peter H. |last=Salus |author-link=Peter H. Salus |title=The Daemon, the Gnu and the Penguin |url=http://www.groklaw.net/article.php?story=20050422235450910 |publisher=[[Groklaw]] |year=2005}}</ref> and got included in the [[Berkeley Software Distribution]].


ex was eventually given a screen oriented visual interface (adding to its command line oriented operation), thereby becoming the [[vi]] text editor. In recent times, ex is implemented as a personality of the vi program; most variants of vi still have an "ex [[Mode (computer interface)|mode]]", which is invoked using the command <code>ex</code>, or from within vi for one command by typing the ''':''' (colon) character. Although there is overlap between ex and vi functionality, some things can only be done with ex commands, so it remains useful when using vi.
ex was eventually given a full-screen visual interface (adding to its command line oriented operation), thereby becoming the [[Vi (text editor)|vi]] text editor. In recent times, ex is implemented as a personality of the vi program; most variants of vi still have an "ex [[Mode (user interface)|mode]]", which is invoked using the command <code>ex</code>, or from within vi for one command by typing the <code>:</code> (colon) character. Although there is overlap between ex and vi functionality, some things can only be done with ex commands, so it remains useful when using vi.


==Relation to vi==
The core ex commands which relate to search and replace are essential to vi. For instance, the ex command issued from vi <code>:%s/XXX/YYY/g</code> replaces every instance of XXX with YYY. The <code>%</code> means every line in the file. The 'g' stands for global and means replace every instance on every line (if it was not specified, then only the first instance on each line would be replaced).
The core ex commands which relate to search and replace are essential to vi. For instance, the ex command {{code|:%s/XXX/YYY/g|vim}} replaces every instance of {{mono|XXX}} with {{mono|YYY}}, and works in vi too. The {{mono|%}} means every line in the file. The 'g' stands for global and means replace every instance on every line (if it was not specified, then only the first instance on each line would be replaced).


==Command-line invocation==
ex has a [[synonym]] '''e''' in [[HP-UX]] environments.


==Switches==
===Synopsis===
ex [-rR] [-s|-v] [-c ''command''] [-t ''tagstring''] [-w ''size''] [''file''...]
ex recognises the following switches:


===Options===
* - (obsolete) suppresses user-interactive feedback
; -r : recover specified files after a system crash
* -s ([[XPG4]] only) suppresses user-interactive feedback
; -R : sets readonly
* -l sets [[lisp editor]] option
; -s : ([[XPG4]] only) suppresses user-interactive feedback
* -r recover specified files after a system crash
; -v : invoke visual mode (vi)
* -R sets readonly
; -c ''command'' : Execute command on first buffer loaded from file. May be used up to ten times.
* -t tag Edit the file containing the specified tag
; -t ''tagstring'' : Edit the file containing the specified tag
* -v invoke visual mode (vi)
; -w ''size'' : Set window size
* -w set window size ''n''
; - : (obsolete) suppresses user-interactive feedback
* -x set encryption mode
; -l : Enable [[Lisp (programming language)|Lisp]] editing mode
* -C encryption option
; -x : Use encryption when writing files
* file specifies file to be edited
; -C : encryption option
; ''file'' : The name(s) of the file(s) to be edited


==See also==
==See also==
*[[List of Unix programs]]
*[[List of Unix commands]]


==References==
== External links ==
{{Reflist}}

==External links==
{{Wikibooks|Guide to Unix|Commands}}
* {{man|cu|ex|SUS|text editor}}
* {{man|cu|ex|SUS|text editor}}

== Notes ==
{{reflist}}


{{Unix commands}}
{{Unix commands}}
Line 41: Line 56:
[[Category:Unix SUS2008 utilities]]
[[Category:Unix SUS2008 utilities]]
[[Category:Unix text editors]]
[[Category:Unix text editors]]
[[Category:Line editor]]

{{Unix-stub}}

[[ar:إكس (محرر نصوص)]]
[[de:Ex (Texteditor)]]
[[el:Ex (διορθωτής κειμένου)]]
[[es:Ex (editor de texto)]]
[[ko:Ex (유닉스)]]
[[hu:Ex (text editor)]]
[[nl:Ex (editor)]]
[[pl:Ex (Unix)]]
[[ru:Ex (Unix)]]
[[fi:Ex]]
[[uk:Ex]]
[[zh:Ex (文件編輯器)]]

Latest revision as of 22:05, 30 November 2024

ex
Original author(s)Bill Joy
Initial releaseMarch 9, 1978; 46 years ago (1978-03-09) (as part of 1BSD)
Written inC
Operating systemUnix
PlatformCross-platform
TypeText editor

ex, (short for extended),[1][2][better source needed] is a line editor for Unix systems originally written by Bill Joy[3] in 1976, beginning with an earlier program written by Charles Haley.[4] Multiple implementations of the program exist; they are standardized by POSIX.[5]

History

[edit]

The original Unix editor ed was distributed with the Bell Labs versions of the operating system in the 1970s. George Coulouris of Queen Mary College, London, which had installed Unix in 1973, developed an improved version called em in 1975 that could take advantage of video terminals.[6] While visiting Berkeley, Coulouris presented his program to Bill Joy, who modified it to be less demanding on the processor; Joy's version became ex[7] and got included in the Berkeley Software Distribution.

ex was eventually given a full-screen visual interface (adding to its command line oriented operation), thereby becoming the vi text editor. In recent times, ex is implemented as a personality of the vi program; most variants of vi still have an "ex mode", which is invoked using the command ex, or from within vi for one command by typing the : (colon) character. Although there is overlap between ex and vi functionality, some things can only be done with ex commands, so it remains useful when using vi.

Relation to vi

[edit]

The core ex commands which relate to search and replace are essential to vi. For instance, the ex command :%s/XXX/YYY/g replaces every instance of XXX with YYY, and works in vi too. The % means every line in the file. The 'g' stands for global and means replace every instance on every line (if it was not specified, then only the first instance on each line would be replaced).

Command-line invocation

[edit]

Synopsis

[edit]
ex [-rR] [-s|-v] [-c command] [-t tagstring] [-w size] [file...]

Options

[edit]
-r
recover specified files after a system crash
-R
sets readonly
-s
(XPG4 only) suppresses user-interactive feedback
-v
invoke visual mode (vi)
-c command
Execute command on first buffer loaded from file. May be used up to ten times.
-t tagstring
Edit the file containing the specified tag
-w size
Set window size
-
(obsolete) suppresses user-interactive feedback
-l
Enable Lisp editing mode
-x
Use encryption when writing files
-C
encryption option
file
The name(s) of the file(s) to be edited

See also

[edit]

References

[edit]
  1. ^ vi editor history:ex
  2. ^ "A Brief History of Vim:1976". Archived from the original on 2021-06-05. Retrieved 2021-06-05.
  3. ^ ex manual page
  4. ^ William N. Joy, Ex reference manual, November, 1977
  5. ^ ex – Shell and Utilities Reference, The Single UNIX Specification, Version 4 from The Open Group
  6. ^ George Coulouris: Bits of History
  7. ^ Salus, Peter H. (2005). The Daemon, the Gnu and the Penguin. Groklaw.
[edit]