I have text file:
gvim file.txt In UNIX you can type this at any command prompt. If you are running Microsoft Windows, open an MS-DOS prompt window and enter the command. In either case, Vim starts editing a file called file.txt. Because this is a new file, you get a blank window. This is what your screen will look like: +---------------------------------------+ |# | |~ | |~ | |~ | |~ | |"file.txt" [New file] | +---------------------------------------+ ('#" is the cursor position.) The tilde (~) lines indicate lines not in the file. In other words, when Vim runs out of file to display, it displays tilde lines. At the bottom of the screen, a message line indicates the file is named file.txt and shows that you are creating a new file. The message information is temporary and other information overwrites it.
Tree file:
^$ text. text\n - join lines in this block, because ends block dot more text.\n ^$ ^$ text.\n text: text\n - join lines in this block, because ends block > more text>\n ^$ text.\n - but not this, because don't ends '., :, > or !' text\n ^$
TASK:
- I want to select a block of text with more than one line ending with
.
,:
,>
or!
using only regex - Replace end of line characters to spaces
- How do I do this with vim, bash, perl, or awk to solve this task.
I want understand the difference in the operation, to select the best tool for working with text.
Trying to create a regex in Vim:
/^\s*\(.*\).
this select all block text
/[!\.:>]$
this select ended
.
,:
,>
or!
/^\s*\(.*\)[!\.:>]$
this select only line ended
.
,:
,>
or!
/^\s*\(.*\)[!\.:>]
this select only line containing
.
,:
,>
or!
therein
but my abilities are limited