Questions tagged [ex]

For questions pertaining the ex utility, a line-oriented text editor first developed by Bill Joy in 1976. The ex editor was later extended with a "visual mode", which turned into the vi screen editor. Use this tag for questions about ex itself, using ex, or questions about issues arising from the usage of utility itself.

ex is a line editor which serves as the foundation of . ex commands work on the current line or on a range of lines in a file. ex is invoked using the colon syntax within vi, and can be invoked on its own from the shell.

External reference

ex specification (The Open Group Base Specifications Issue 7, 2018 edition)

13 questions
14
votes
3 answers

How can I use sed or ex to replace a block (multi-line code) with new block of text (code)?

I have to replace a large block of a text (shell script code) in a file with another block of text. I am impressed with the How can I use sed to replace a multi-line string? answered by antak and Multi-line replace answered by Bruce Ediger But I…
gibies
  • 351
  • 1
  • 3
  • 10
8
votes
1 answer

EX editor: go to previous file

Using ex I open 3 files ex file1 file2 file3 I know the command :n goes to file 2 and file3 the command :rew go to file1 from file3 or file2 But what command can I use to go to previous file? I think :e previousfile will work, but does…
elbarna
  • 12,050
  • 22
  • 92
  • 170
6
votes
1 answer

Place Single Dot With Vim/Ex

I'm messing around with vim one liners, and I'm unable to escape a . character in a vim ex mode append command. Basically, vim -En '+a|Hello World' '+p' '+q!' - prints "Hello World" But, vim -En '+a|.' '+p' '+q!' - prints nothing at all. The .…
dhakim
  • 63
  • 3
3
votes
3 answers

How to find last matching line with ex?

The ex command $ navigates to the first character of the last line. Therefore, when doing a backwards search it skips the line it's currently on. How do I navigate to the last character with ex, or alternatively search for the last occurrence of a…
l0b0
  • 50,672
  • 41
  • 197
  • 360
2
votes
1 answer

Is replacing a particular line in a file through a bash script possible in VIM or EX?

I would like to modify a particular line, say line 5, in a file by using the EOEX construct how can I achieve my aim? The code snippet that I use to achieve my purpose is as follows: #!/bin/bash S=0.030 F=0.150 N=30 DIFF=`echo "scale=3; $F - $S" |…
Vesnog
  • 679
  • 4
  • 11
  • 29
1
vote
2 answers

How to end the "i" command in ex

While experimenting with the ex text editor, I executed the :$i command (which inserts text before the final line) and found myself unable to proceed. I assumed that I could return to normal mode by pressing esc, similar to vi(m), but it didn't have…
TSJNachos117
  • 359
  • 1
  • 9
1
vote
1 answer

(n)vi - Erase in ex mode

How does one erase characters in ex mode (':' command line) of (n)vi 1.79 or make 'Backspace' behave as in Vim? 'Backspace' and 'Delete' only move the cursor left, from where new keystrokes overwrite instead of preferably inserting. This is the…
1
vote
1 answer

What are the main differences between the ed and the ex editor?

The ex editor is often touted as an enhancement and simplification of ed. I would like to know what specific enhancements and simplifications it offers. GNU ed, for example, offers extended regular expressions. So, besides these, what advantages…
Edman
  • 472
  • 2
  • 9
1
vote
2 answers

Find a string and replace another string on a following line after the first string is found

Given a file with the following content: pkg1: replicaCount: 1 image: tag: latest pullPolicy: Always pkg2: replicaCount: 2 image: tag: latest pullPolicy: Always I want to search for the tag that is attached to a specific…
JulieMarie
  • 111
  • 1
  • 3
1
vote
1 answer

Does traditional vi (not vim) have large file support?

Is there a way to compile traditional Vi (ex) with large-file (3+ GB) support? I'm trying to open a file that is around 3.5GBs in size and Vi simply says: Tmp file too large. If large-file support isn't a thing, is there a way to specify a larger…
Alexej Magura
  • 4,356
  • 7
  • 26
  • 39
0
votes
0 answers

How is ex implemented in vim?

Now I am reading a book on sed and awk and to learn the history needed to use ed and ex commands. I thought for a vim user on Arch Linux, there is no need to install other packages but I found that ex is not included in the gvim, vim-runtime…
Taro
  • 101
  • 1
0
votes
1 answer

How to use vim command-mode indention in ex colon-mode?

I am trying to script some file changes using ex per this answer. The issue that I'm running into is that ex seems to assume that every command is preceded by a colon, so while I can do something like: /^foo() a test insertion . w! q I can't…
Dan
  • 3
  • 1
0
votes
1 answer

How to use 'itextESC' when using ex as a text editor in command line?

I like using the traditional ex editor for simple command line operations, to re-arrange text within files. For example for a simple moving lines across in a file I would use something like foo bar zoo dude to move the text dude after foo I would…
Inian
  • 12,472
  • 1
  • 35
  • 52