Sponsored Content
Top Forums UNIX for Dummies Questions & Answers Insert line break in vi's command mode Post 302125680 by Shell_Life on Friday 6th of July 2007 09:22:04 AM
Old 07-06-2007
There are several ways you can split a line in 'vi'.
It will also depend on your criteria:
1) If you want to split lines without a defined logic that you can use
a regular expression, the only way is "i+return+esc" then for the next
times, "." (period).

2) If you can use a logic where a regular expression can define it:
:%s/\(RegExp\)/\1^M/

Where:
RegExp: Regular Expression.
^M: ctl-M (entered as ctl-V+ctl-M)
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

how to insert line break + string in vi (search & replace )

Hello all i have big test file that has allot of structure text something like this : <foo1 *.html> <blah action> somthing 1 somthing 2 </blah> </foo1 > now i will like to insert 2 more lines of text below the <blah action> so it will be like : <foo1... (1 Reply)
Discussion started by: umen
1 Replies

2. Shell Programming and Scripting

Insert line break

Dear All, thanks in advance input file 410530AAANNNNNAAA410530JJJJJJYYYY410530PPPPPAAAAAA........... I want output like 410530AAANNNNNAAA 410530JJJJJJYYYY 410530PPPPPAAAAAA Thanks (10 Replies)
Discussion started by: The_Archer
10 Replies

3. UNIX for Advanced & Expert Users

unix command : how to insert text at the cursor location via command line?

Hi, Well my title isn't very clear I think. So to understand my goal: I have a script "test1" #!/bin/bash xvkbd -text blabla with xbindkeys, I bind F5 key in order it runs my test1 script So when I press F5, test1 runs. I'm under Emacs/Vi and I press F5 in order to have "blabla" be... (0 Replies)
Discussion started by: xib.be
0 Replies

4. UNIX for Advanced & Expert Users

What is the difference between single line mode and multiline mode in Regular expressions?

Hi All, Can please let me know what is the difference between the single line mode and multi line mode in regular expresions? Thanks, Chidhambaram B (3 Replies)
Discussion started by: chidhu.anu
3 Replies

5. UNIX for Dummies Questions & Answers

Insert a break page after certain string using SED

Hi: I have 2 files: teststring.txt and a tempfile.txt teststring file contains: s/Primary Ins./\n1/g I'm trying to search for "Primary Ins." string in tempfile. For every "Primary Ins." string that is found, a new line is inserted and put in number 1. Then, write out the newfile... (7 Replies)
Discussion started by: newbeee
7 Replies

6. Shell Programming and Scripting

Insert shell command into first line of output file

How can I insert the command executed on the shell into the first line of my output file? For example if I execute; zcat *.gz |grep “User5501” > users.out How can I make my users.out look like; zcat *.gz |grep “User5501” > users.out User5501 PA User5501 UA User5501 ZA... (3 Replies)
Discussion started by: lewk
3 Replies

7. Shell Programming and Scripting

one line command to change mode only if necessary

hi, sorry for posting this for a quick answer. Is there a one line command to change permissions on files in a directory to a given mode (say 554) and only for those files that do not already have that mode? Running chmod updates the last access/modified timestamp on the files, and i want to... (11 Replies)
Discussion started by: ysrini
11 Replies

8. Red Hat

How to start Fedora 11 in command line mode and skip damaged programs ??

Hi All, Please let me know that how to start Fedora 11 in command line mode and skip damaged programs ?? Scenario being: I have Fedora 11 ( pretty ole... eh !! ). If I try to start the PC , then after some steps of startup... it just hangs and does not boots. I tried entering the mode... (4 Replies)
Discussion started by: dipanchandra
4 Replies

9. UNIX for Dummies Questions & Answers

sed command to Insert a line before the last four lines of the file

By using sed command, How to insert a new line before the last four lines of the file. Old Line Old Line NEW LINE! Old Line Old Line Old Line Old Line (8 Replies)
Discussion started by: wridler
8 Replies

10. UNIX for Beginners Questions & Answers

Shell vim defaulting to Insert or Command mode

On a daily basis I need to SSH into several different RHEL servers using Putty. On some of the servers, if I up arrow to get a previous command, it automatically starts in Input Mode, so if I press up arrow, then 'x' it will type the letter x at the end of the command line. On other servers, it... (4 Replies)
Discussion started by: derndingle
4 Replies
JE::Object::RegExp(3pm) 				User Contributed Perl Documentation				   JE::Object::RegExp(3pm)

NAME
JE::Object::RegExp - JavaScript regular expression (RegExp object) class SYNOPSIS
use JE; use JE::Object::RegExp; $j = new JE; $js_regexp = new JE::Object::RegExp $j, "(.*)", 'ims'; $perl_qr = $js_regexp->value; $some_string =~ $js_regexp; # You can use it as a qr// DESCRIPTION
This class implements JavaScript regular expressions for JE. See JE::Types for a description of most of the interface. Only what is specific to JE::Object::RegExp is explained here. A RegExp object will stringify the same way as a "qr//", so that you can use "=~" on it. This is different from the return value of the "to_string" method (the way it stringifies in JS). Since JE's regular expressions use Perl's engine underneath, the features that Perl provides that are not part of the ECMAScript spec are supported, except for "(?s)" and "(?m)", which don't do anything, and "(?|...)", which is unpredictable. In versions prior to 0.042, a hyphen adjacent to "d", "s" or "w" in a character class would be unpredictable (sometimes a syntax error). Now it is interpreted literally. This matches what most implementations do, which happens to be the same as Perl's behaviour. (It is a syntax error in ECMAScript.) METHODS
value Returns a Perl "qr//" regular expression. If the regular expression or the string that is being matched against it contains characters outside the Basic Multilingual Plane (whose character codes exceed 0xffff), the behavior is undefined--for now at least. I still need to solve the problem caused by JS's unintuitive use of raw surrogates. (In JS, "/../" will match a surrogate pair, which is considered to be one character in Perl. This means that the same regexp matched against the same string will produce different results in Perl and JS.) class Returns the string 'RegExp'. SEE ALSO
JE JE::Types JE::Object perl v5.14.2 2012-03-18 JE::Object::RegExp(3pm)
All times are GMT -4. The time now is 07:11 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy