Appending character "0" in vi editor for all lines between 1 and 40.


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Appending character "0" in vi editor for all lines between 1 and 40.
# 1  
Old 07-02-2010
Appending character "0" in vi editor for all lines between 1 and 40.

I have to append character "0" for lines between 1 and 40 in a file.

I tried the following code.
Code:
:s/^0,1,40/g

Input:
Quote:
abac
kaga
kal
Output:
Quote:
0abac
0kaga
0kal
# 2  
Old 07-02-2010
Code:
:1,40s/^/0/

# 3  
Old 07-02-2010
Thanks!!
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. UNIX for Beginners Questions & Answers

VI editor keeps automatically adding new lines with "P" char ..

Hello, I am on AIX operating system. Recently, when I open any file in vi editor, it starting adding lines automatically with "P" char in the beginning of each line. This also happens when I open crontab ( crontab -e) ..I have looked in to my .profile and nothing has changed in there for such... (4 Replies)
Discussion started by: shethkb
4 Replies

2. UNIX for Dummies Questions & Answers

Grep : Filter/Move All The Lines Containing Not More Than One "X" Character Into A Text File

Hi All It's me again with another huge txt files. :confused: What I have: - I have 33 huge txt files in a folder. - I have thousands of line in this txt file which contain many the letter "x" in them. - Some of them have more than one "x" character in the line. What I want to achieve:... (8 Replies)
Discussion started by: Nexeu
8 Replies

3. Shell Programming and Scripting

Find lines with "A" then change "E" to "X" same line

I have a bunch of random character lines like ABCEDFG. I want to find all lines with "A" and then change any "E" to "X" in the same line. ALL lines with "A" will have an "X" somewhere in it. I have tried sed awk and vi editor. I get close, not quite there. I know someone has already solved this... (10 Replies)
Discussion started by: nightwatchrenba
10 Replies

4. UNIX for Advanced & Expert Users

Remove lines if the first character is "|"

Hi. I have a huge file (350 million lines). I need to delete all lines in it that: 1. Begin with a pipe character -- '|' 2. Or have less than 5 pipe characters in the line Have been searching for some SED/AWK help for this (which is faster btw on such a ginormous file?) but only... (7 Replies)
Discussion started by: pkiula
7 Replies

5. Shell Programming and Scripting

Using sed to find text between a "string " and character ","

Hello everyone Sorry I have to add another sed question. I am searching a log file and need only the first 2 occurances of text which comes after (note the space) "string " and before a ",". I have tried sed -n 's/.*string \(*\),.*/\1/p' filewith some, but limited success. This gives out all... (10 Replies)
Discussion started by: haggismn
10 Replies

6. UNIX for Dummies Questions & Answers

"vi" text editor character encoding?

Hi! I've got a shell account on a FreeBSD machine. It doesn't have 'vim' installed, but only the original 'vi' text editor ("Version 1.79 (10/23/96) The CSRG, University of California, Berkeley.") So, in PuTTY I've chosen "UTF-8 translation" to have my non-english characters appear correctly.... (2 Replies)
Discussion started by: Gew
2 Replies

7. Shell Programming and Scripting

How to print range of lines using sed when pattern has special character "["

Hi, My input has much more lines, but few of them are below pin(IDF) { direction : input; drc_pinsigtype : signal; pin(SELDIV6) { direction : input; drc_pinsigtype : ... (3 Replies)
Discussion started by: nehashine
3 Replies

8. Shell Programming and Scripting

Command Character size limit in the "sh" and "bourne" shell

Hi!!.. I would like to know what is maximum character size for a command in the "sh" or "bourne" shell? Thanks in advance.. Roshan. (1 Reply)
Discussion started by: Roshan1286
1 Replies

9. UNIX for Advanced & Expert Users

Command Character size limit in the "sh" and "bourne" shell

Hi!!.. I would like to know what is maximum character size for a command in the "sh" or "bourne" shell? Thanks in advance.. Roshan. (1 Reply)
Discussion started by: Roshan1286
1 Replies

10. UNIX for Dummies Questions & Answers

Command Character size limit in the "sh" and "bourne" shell

Hi!!.. I would like to know what is maximum character size for a command in the "sh" or "bourne" shell? Thanks in advance.. Roshan. (1 Reply)
Discussion started by: Roshan1286
1 Replies
Login or Register to Ask a Question