Making Changes to large file in vi


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Making Changes to large file in vi
# 1  
Old 04-07-2012
Making Changes to large file in vi

so i have a large file that has many lines in it.

i want to make changes (replace certain things) that are in a range of lines, but NOT the whole file.

how do i do this?

say for instance, if i want to change all the occurrences of the word "ramamama" to "ram cow welcome" in lines 9333 to 35000. How do i do this?

below is as far as i've gotten:

Code:
:%s~ramamama~ram cow welcome~g

# 2  
Old 04-07-2012
Code:
:9333,35000s/ramamama/ram cow welcome/g

# 3  
Old 04-07-2012
Quote:
Originally Posted by keb0x80
Code:
:9333,35000s/ramamama/ram cow welcome/g


can the slashes be avoided?
# 4  
Old 04-07-2012
If you're using vim you can replace the slashes with another character. I'm not sure in other versions of vi though.
This User Gave Thanks to keb0x80 For This Post:
# 5  
Old 04-08-2012
Quote:
Originally Posted by keb0x80
Code:
:9333,35000s/ramamama/ram cow welcome/g


i just tested it. unfortunately, it appears it isn't working.
# 6  
Old 04-08-2012
Please post what Operating System and version you are running and what Shell you are using.

Please post quantative figures for your file.
Exact size?
Number of records?
Largest record size?

And for your computer:
How much memory do you have fitted?


Quote:
can the slashes be avoided?
Why? There is no solidus in your strings.
Does the command work WITH the solidii?
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

Making replicates of a file with part of a line randomized for each file

Ok, so let's say that I have a file like the following: I want to create 100 replicates of this file, except that for each file, I want different randomized combinations of either A or B at the end of each line so that I would end up with files like the following: and etc. I... (1 Reply)
Discussion started by: Scatterbrain26
1 Replies

2. UNIX for Dummies Questions & Answers

Making file executable

Hi guys, i'm trying to make a file called 'run-all-tests' executable but it is not letting me for some reason. I am presented with the following error: chmod: cannot access `./run-tests': No such file or directory Basically i have a folder called ex3 and within that there are task folders:... (11 Replies)
Discussion started by: Shyamz1
11 Replies

3. Programming

Making hard link to a file in C

hi there guys could someone please, show me how to make a hard link to a file in c language ? i am using minix. The program below reads the last number from file numbers, adds a one to it and then appends the new number into the file. I use a c script as driver to this program, the c script... (1 Reply)
Discussion started by: surubi_abada
1 Replies

4. Shell Programming and Scripting

Making Large Connection nodes for Graph

Hi power user, Basically, this thread is a continuation of the previous one :): https://www.unix.com/shell-programming-scripting/110650-making-connection-nodes-graph.html#post302326483 However, I'm going to explain it again. I have this following data: file1 aa A ... (3 Replies)
Discussion started by: anjas
3 Replies

5. AIX

Making Executable File

Hi All: I am a newbie. I have shell script and bunch of java jar files and I want to give one single executable file (may be .bin). Ex: I have test.sh, jar1.jar, jar2.jar. I have to make process.xxx When we run "process.xxx" it will run the "test.sh" script which inturn uses jar1.jar and... (0 Replies)
Discussion started by: laxman123
0 Replies

6. UNIX for Dummies Questions & Answers

problem while making ftp of a large file

Hi Friends, I'mfacing a problem while doing ftp of a large file.The control session is getting closed after sometime.But data session transfers the file successfully even when the control seeion is lost.I need to make the control session available as long as data session is active. How can i... (1 Reply)
Discussion started by: rprajendran
1 Replies

7. SCO

making an iso file...

can i make an iso file from my DAT tape? pref .ISO? the thing is .. i have an 5.0.7 and a complete backup of hd (cpio cmd) on to tape (find . -depth -print | cpio -oVcB -C 20480 -O /dev/rStp0) that i made after booting from boot&root floppies now i want to take this backup and dump it on... (5 Replies)
Discussion started by: asafronit
5 Replies

8. Shell Programming and Scripting

making the changes permanent in a file

Hi Friends. I have a file called install.data which has fields like : XXXXX ACVCGFFTFY UAHIUH OI CONNECTION=tape/11/ LOCATAION=08-90-89 SIZE=90 I had to change the values of some of these variables. So i did : grep "SIZE" instal.data | sed 's/*/00/' ...this is working fine on command... (4 Replies)
Discussion started by: vijaya2006
4 Replies

9. Shell Programming and Scripting

Making Changes without opening file

Hello, I'm new to scripting, I have a file test.dat. I want to make changes to it with out openning it. Example: test.dat has rows, and I want to change value "LA" to "TX" without opening it or without writing it to another file. Is it possible? Thanks (9 Replies)
Discussion started by: irehman
9 Replies

10. Shell Programming and Scripting

sed : Making changes in the same file

sed 's/abc/xyz/g' abc.txt > abc.txt This change all the abc s in abc.txt to xyz s but does not write back to the abc.txt. Suggest me the cleaner way without using temp file please. Cheers, Amol. (3 Replies)
Discussion started by: amol
3 Replies
Login or Register to Ask a Question