Questions tagged [ed]

ed is a line-oriented text editor for Unix. Use this tag for questions related to ed scripting; questions about interactive usage are considered off-topic.

ed was created in 1969 by Ken Thompson as a simplified successor to the QED editor and was part of the first version of Unix. It is still part of the POSIX standard.

Unlike visual ("full-screen") editors such as vi/vim, ed is a line editor. It pioneered and influenced many features seen in popular tools such as grep, sed, ex, and vi/vim.

ed commands can be stored in scripts; notably, the diff tool can be set to generate ed commands when using the -e command line option.

Questions about scripting with ed are likely to be suitable for Stack Overflow; questions about interactive usage might be better suited for Unix & Linux or Super User.

References

66 questions
0
votes
2 answers

Insert lines between two matching patterns using sed or awk

I have lines in text.txt as follows start:xfedfgrrg vfefvrgvr efefrg end: abc end : xyz start:ewef feefvef frrfer end:ccbf start:e3frrf f2erv frf end: ece end: d32d2d end: fff I want to add few lines (let's say hello world) everytime patten…
Rahul P
  • 1
  • 1
0
votes
1 answer

meaning of \n and \d when used in ed?

I want to edit a file. I want to search for a string and delete the line containing the string and 19 lines before it. I found a similar question on another site (the topic is closed now), and the answer given was to use the following ed commands…
0
votes
1 answer

Pass String as variable in ed text editor unix

I need to add a header to an existing file in unix as a part of my requirement. For that I used ed text editor got from this discussion How can I add a line to a file in a shell script? This is the code I used printf '0a\n%s\n.\nw\n',$header, | ed…
mvg
  • 1,574
  • 4
  • 37
  • 63
-1
votes
3 answers

Move contents of one section above another section in a configuration file

I have a requirement to move [mysqld] section in a mysql configuration file above another section named #SAFE# in a mysql configuration file and after the section is moved there should be space between the sections,Please find the below code and…
Raj
  • 13
  • 3
-1
votes
1 answer

remove spaces between words for a very long line in vim

How to remove spaces between much words in a single long line using vim? Already tried tried : s/ \+/ / and examples of this. Doesnt work. I have a line kinda this: """ http:// goo gle. com / ? script & GetReferen ce?login = LOGIN¬Logi n & and…
kAldown
  • 610
  • 2
  • 8
  • 27
-3
votes
1 answer

How I can add the same text to several files via script?

I want a simple way to add the same text (e.g. "bye" or more lines) to a group of files using a small script. I tried something with ed and vi inside of a script, but it did'nt work. Edit: I edit this coment to be more specific: I have the files…
git
  • 151
  • 9
1 2 3 4
5