VI questions : mass changes, mass delete and external insert


 
Thread Tools Search this Thread
Operating Systems AIX VI questions : mass changes, mass delete and external insert
# 1  
Old 12-13-2006
VI questions : mass changes, mass delete and external insert

Is it possible in VI to do a global change but take the search patterns and the replacement patterns from an external file ?

I have cases where I can have 100,200 or 300+ global changes to do. All the new records are inside a file and I must VI a work file to change all of them.


Also, can I do a mass delete on records given by an external file no matter where those records are in VI ?

And insert content of a whole file at any given point in VI ?


I do not think I have autority to replace or recreate the files I am editing at the office. Only the search pattern files I can create as I like.
# 2  
Old 12-13-2006
mass changes,delete,insert

I think a more appropriate solution is to use sed.

$ sed -f script_file file_to_be_changed

script_file contains the many search and replace operations you have...like:
....
s/abc/def/g
s/^[a-z]/x/g
/pattern/d
......


$ man sed (to know more) Smilie
Login or Register to Ask a Question

Previous Thread | Next Thread

9 More Discussions You Might Find Interesting

1. Cybersecurity

Mass account creation

By the company winning business from another outsource provider, I've suddenly inherited towards 300 servers and all accounts are local. One of the immediate tasks is to set up all the OS, DB, and app support staff on all of the servers operating systems. I've slapped together a crude script... (10 Replies)
Discussion started by: rbatte1
10 Replies

2. UNIX for Dummies Questions & Answers

Need help to mass rename files

Hi. I've got 75 mp3s that have the word 'Émission' in their filename. They are all in this format: Émission bla1 bla1.mp3 Émission bla2 bla2.mp3 Émission bla3 bla3.mp3 etc... I would just like to mass replace 'Émission' by 'Emission'; basically replace 'É' with 'E'. The rest of the... (10 Replies)
Discussion started by: Kingzy
10 Replies

3. Shell Programming and Scripting

Mass add users

Anyone has a script or something that can do this? I have a list of about 500 users and I need to add them to an AIX box. The profiles should have "Full Name" and "User Name". (2 Replies)
Discussion started by: bbbngowc
2 Replies

4. Shell Programming and Scripting

mass file mv

I have 100k+ files in a directory. I wanna create new directories and move each 2500 files into a new directory. Thank you very much. (2 Replies)
Discussion started by: Sean2008
2 Replies

5. UNIX for Dummies Questions & Answers

Mass file renaming

Hi :) Is there any command I could use to rename a bunch of files resident of the same location to their original name plus a fixed text string of my own? Example: File1 File2 File3 Output: File1.txt File2.txt File3.txt This is easy using a "for" loop but what I want is a one-line... (5 Replies)
Discussion started by: Indalecio
5 Replies

6. Shell Programming and Scripting

Mass Change

We will be updating to Unidata 7.1; I need a way to update the '.profile' entries to change 'ud60' to 'ud71' in each user's '.profile'. Does anyone have the script to do this without causing permission problems? (3 Replies)
Discussion started by: mbatchelor
3 Replies

7. UNIX for Dummies Questions & Answers

Mass Copy/rename

Don't tell me DOS can do something UNIX can't do! I want to copy a number of files from one directory to another, and at the same time change the names. The name changes would be common, e.g., all files starting with the letter 'L' and ending in '30.NEW554', with the copied or new files also... (6 Replies)
Discussion started by: lwilsonFG
6 Replies

8. UNIX for Dummies Questions & Answers

mass delete a certain string in a .log file

Hey all. I have a file that has roughly 115,000 lines in it. There are a few lines of information that I don't want in it, but I don't want to search through all of the lines to find the ones that I don't want. Is there a way to do a mass delete of the lines that I don't want? Thanks for the... (4 Replies)
Discussion started by: jalge2
4 Replies

9. UNIX for Dummies Questions & Answers

Mass directory creation?

I have a couple thousand data files that all have to have there own directory named exactly the same as the file name. Then the file needs to be moved to that directory. For example files test1.mat, test2.mat, test3.mat in directory X need to have directories test1, test2, test3 created... (6 Replies)
Discussion started by: AeroEngy
6 Replies
Login or Register to Ask a Question