Operating System - HP-UX
1833702 Members
3157 Online
110062 Solutions
New Discussion

Easy VI Question - Wildcard Edits?

 
SOLVED
Go to solution
Laurie_2
Advisor

Easy VI Question - Wildcard Edits?

Hi All,

Can you do a wildcard edit?

I have 20 files, all start
with data12.

When I do:

# vi data12*

I can edit the first file,
and then it tells me there are
more files but it doesn't
refresh and update my
screen.

Laurie
How can you make the world a better place
5 REPLIES 5
Patrick Wallek
Honored Contributor
Solution

Re: Easy VI Question - Wildcard Edits?

To get to the next file in line when you do something like "vi data12*" you do a :n after you have saved the file you are working on.
Uday_S_Ankolekar
Honored Contributor

Re: Easy VI Question - Wildcard Edits?

Hello,

You nned to type :n to go to next file.

Edit first file save it by w
then :n to next file...and so on..

-USA..
Good Luck..
harry d brown jr
Honored Contributor

Re: Easy VI Question - Wildcard Edits?

Make your changes to the file, then

:w!

then :n (colon-n) to go to next file

live free or die
harry
Live Free or Die
Rodney Hills
Honored Contributor

Re: Easy VI Question - Wildcard Edits?

If you are looking to automate the process and do the same changes across multiple files, and you have "perl" installed, then you can do the following-

perl -pie 's/george/henry/' data12*

Would replace "george" with "henry" in all files that start with "data12".

perl -nie 'print if /william/' data12*

Would delete all lines that had william in them.

-- Rod Hills
There be dragons...
Rodney Hills
Honored Contributor

Re: Easy VI Question - Wildcard Edits?

oops,

perl -nie 'print unless /william/'

-- Rod Hills
There be dragons...