Tagged Questions

The tag has no wiki summary.

learn more… | top users | synonyms

1
vote
2answers
50 views

How can I replace ^I into tab spaces in vim editor for .java file?

When I open my .java file in vim, I could see a couple of lines prefixed with one / more ^I characters. It looks like tabs in Eclipse that has got converted into ^I. I would like to replace a single ...
3
votes
3answers
72 views

Why can't ed be exited with C-c?

The program ed, a minimal text editor, cannot be exited by sending it an interrupt through using Ctrl-C, instead printing the error message "?" to the console. Why doesn't ed just exit when it ...
2
votes
1answer
36 views

How does one indent code blocks in `ed`?

I like using ed for small edits. Currently I just press the spacebar manually to indent blocks of code in ed. Is this how the authors of UNIX indented their code in ed? Or is there some shortcut they ...
6
votes
2answers
189 views

Regex `/pattern/g` and ed `:g/pattern/`: which came first, and why `g`?

The g option (e.g. s/pattern/replacement/g) for many tools that use regex-style pattern matching and the :g command in ed, ex, vi, and vim have pretty similar usage and meaning: match the given regex ...
0
votes
1answer
42 views

Getting a delimiter issue while executing the script

I am creating a test.sh file and i am running it as ./test.sh: string="hello" ed << EOF e any_file 1i ${string} EOF can anybody help me what it does? I am getting some delimiter issue. Can ...
10
votes
8answers
2k views

How to remove multiple newlines at EOF?

I have files that end in one or more newlines and should end in only one newline. How can I do that with Bash/Unix/GNU tools? Example bad file: 1\n \n 2\n \n \n 3\n \n \n \n Example corrected ...
2
votes
2answers
252 views

Removing consecutive newlines with ed

Input file: 1 line1\ 2 line2\ 3 line3\ 4 \ 5 line4\ 6 \ 7 \ 8 line5\ Desired output: 1 line1 2 line2 3 line3 4 5 line4 6 7 line5 Is it possible with POSIX ed? Removing the trailing backslashes ...
8
votes
2answers
160 views

How to write a literal dot in ed?

What would be the right way to write a line containing only . to a file in ed? The only way I came up with is something like this: a . s/^$/./