Thursday, October 18, 2007

Search and Replace in Vi

We are working at a client adapting an already developed project so they can do their work with it. The project was developed using django, first with 0.91, then with 0.95, now we are going to use svn trunk. So one of the things that we are using, and a lot, is just plain search and replace. I am currently developing a lot on my Vaio Laptop, using Windows Vista as OS, and Komodo Edit as editor. It has great Find and Replace capabilities, well really i don't know if that could be complicated.

So, the server is a Centos 4, some problemas with the drivers didn't allow us to use our classic FreeBSD, we are still dealing with the issues of using python 2.3 instead of 2.4 which we are used to. So that and the trunk thing are the main reasons to do a lot of searching and replacing.

A great deal of deveolpment is done at a workstation, there it was easy to follow the GUI and just point and click. In Centos it is another story, I use vi or vim normally, even at my workstation at Aureal I use gvim and I love it. But the thing I never learned was to search and replace using plain vi commands. To make things worse I have, like, 2 or 3 points of experience out of 100 in sed. So I knew that it had to be a similar syntax, the classic:

:s/oldstring/newstring/g

So I tried that, but no, it worked only to replace the oldstring in the current line, that was not what I wanted. So once again google knows it all. It gave me the simple and expected answer in the first returned link. It confirmed that the above string just replaces oldstrings in the current line. But, as vi is a great great editor, you can give the command more parameters, so I learned that you could pass a range of line numbers to apply the search and replace, so I just thought that I could use something like this:

:1,$s/oldstring/newstring/g

On a side note, I just recently learned that the $ means "last line". That really helps a lot! But it turns out that there is a shorter way to write this using:

:%s/oldstring/newstring/g

So the % would be equivalent to "1,$".

And thats it, I just learned that this week. And it is useful! I know, for a developer with 3 years of experience not knowing that would be like a sin, but I just never need it like a did today.

29 comments:

Anonymous said...

It is remarkable, it is very valuable information

Anonymous said...

I want not approve on it. I over precise post. Specially the title attracted me to review the whole story.

Anonymous said...

Good brief and this mail helped me alot in my college assignement. Thanks you for your information.

Anonymous said...

Opulently I agree but I think the collection should prepare more info then it has.

Anonymous said...

[u][b]Xrumer[/b][/u]

[b]Xrumer SEO Professionals

As Xrumer experts, we secure been using [url=http://www.xrumer-seo.com]Xrumer[/url] for the benefit of a wish leisure for the time being and know how to harness the enormous power of Xrumer and adapt it into a Cash machine.

We also yield the cheapest prices on the market. Assorted competitors devise cost 2x or temperate 3x and a destiny of the continuously 5x what we charge you. But we believe in providing enormous accommodation at a tearful affordable rate. The entire incidental of purchasing Xrumer blasts is because it is a cheaper variant to buying Xrumer. So we train to keep that contemplating in recollection and afford you with the cheapest censure possible.

Not only do we be suffering with the best prices but our turnaround occasion for your Xrumer posting is super fast. We will have your posting done in the forefront you discern it.

We also cater you with a roundish log of loaded posts on contrary forums. So that you can notice also in behalf of yourself the power of Xrumer and how we get harnessed it to help your site.[/b]


[b]Search Engine Optimization

Using Xrumer you can wish to distinguish thousands upon thousands of backlinks in behalf of your site. Many of the forums that your Place you intent be posted on get acute PageRank. Having your link on these sites can really serve establish up some top-grade quality endorse links and uncommonly as well your Alexa Rating and Google PageRank rating through the roof.

This is making your site more and more popular. And with this increase in regard as grammatically as PageRank you can keep in view to see your milieu really downright high in those Search Engine Results.
Conveyance

The amount of see trade that can be obtained nearby harnessing the power of Xrumer is enormous. You are publishing your plat to tens of thousands of forums. With our higher packages you may regular be publishing your site to HUNDREDS of THOUSANDS of forums. Visualize 1 collection on a stylish forum last will and testament by rig out 1000 or so views, with signify 100 of those people visiting your site. At once imagine tens of thousands of posts on in demand forums all getting 1000 views each. Your shipping ordain withdraw through the roof.

These are all targeted visitors that are interested or exotic nearly your site. Envision how divers sales or leads you can fulfil with this colossal loads of targeted visitors. You are truly stumbling upon a goldmine friendly to be picked and profited from.

Reminisce over, Transport is Money.
[/b]

GO YOUR TWOPENNY BURST TODAY:


http://www.xrumer-seo.com

Anonymous said...

Infatuation casinos? endorse this late-model [url=http://www.realcazinoz.com]casino[/url] apprise and convey afar up online casino games like slots, blackjack, roulette, baccarat and more at www.realcazinoz.com .
you can also around our warn [url=http://freecasinogames2010.webs.com]casino[/url] orientate at http://freecasinogames2010.webs.com and survive punishment undistorted folding spondulix !
another drift [url=http://www.ttittancasino.com]casino spiele[/url] in the sector of is www.ttittancasino.com , because german gamblers, pressurize manumitted online casino bonus.

Anonymous said...

[url=http://www.ganar-dinero-ya.com][img]http://www.ganar-dinero-ya.com/ganardinero.jpg[/img][/url]
[b]Estas buscando formas de ganar dinero[/b]
Nosotros hemos hallado la mejor pagina web en internet de como ganar dinero desde casa. Como nos ha sido de interes para nosotros, tambien les puede ser de interes para ustedes. No son solo formas de ganar dinero con su pagina web, hay todo tipo de formas para ganar dinero en internet...
[b][url=http://www.ganar-dinero-ya.com][img]http://www.ganar-dinero-ya.com/dinero.jpg[/img][/url]Te recomendamos entrar a [url=http://www.ganar-dinero-ya.com/]Ganar-dinero-ya.com[/url][url=http://www.ganar-dinero-ya.com][img]http://www.ganar-dinero-ya.com/dinero.jpg[/img][/url][/b]

Anonymous said...

Someone deleted a variety of links from letitbit and vip-file ...

From now, we will use www.tinyurlalternative.com as our main [url=http://www.tinyurlalternative.com]url shortener[/url], so every url will be there and visible for everyone.

You can choose from several great [url=http://kfc.ms]short url[/url] names like:

kfc.ms easysharelink.info jumpme.info megauploadlink.info megavideolink.info mygamelink.info myrapidsharelink.info mytorrentlink.info myurlshortener.com mywarezlink.info urlredirect.info urlshrinker.info weblinkshortener.com youtubelink.info and many others.

They maintain above 60 different available domains and the [url=http://myurlshortener.com]url shortener[/url] service work well for free without any registration needed.

So we think it is good notion and propose you to use [url=http://urlredirect.info]url redirect[/url] service too!

Thank you.

Anonymous said...

Making money on the internet is easy in the undercover world of [URL=http://www.www.blackhatmoneymaker.com]blackhat link building[/URL], It's not a big surprise if you don't know what blackhat is. Blackhat marketing uses not-so-popular or misunderstood ways to produce an income online.

Anonymous said...

You could easily be making money online in the underground world of [URL=http://www.www.blackhatmoneymaker.com]blackhat community[/URL], You are far from alone if you have no clue about blackhat marketing. Blackhat marketing uses alternative or little-understood methods to produce an income online.

Anonymous said...

Dear friends

We do not agree with this year BRIT awards 2010 decision.

Please go to see our little survey

http://micropoll.com/t/KDqOnZBCWt

Lady Gaga can not be better than Nina Hagen

Poll supported by BRIT awards 2010 sponsor femmestyle
[url=http://www.femmestyle.ch/schoenheitschirurgie/brustvergroesserung/index.html]brustvergrößerung[/url]

Pet Shop Boys surprise lucky BRITs fan with a MasterCard Priceless Gig in their living room

Anonymous said...

Good day!
My name is Tom, I live in Fort Worth, TX.

I am here to network / interact with other people for sharing knowledge, discussing ideas, seeking advice, find business partners & the like.


Keep smiling!

Anonymous said...

Продаётся клубничная рассада
Сорта: Elsanta, Mauling Pandror, Gigant Maximus, WIKOT, Senga Dulcita, Kamaroza
[img]http://litva4u.com/images/normal/113522.jpg[/img]
Цена: 0,25$

Все вопросы по телефону: +371-27041630
e-mail: klugakluga@inbox.lv

Anonymous said...

hi im new here i like [URL=http://www.mydjspace.net]dj download[/URL] in my spare time. I hope to be able to contribute on this message board and should stay around!

Thx's.

Anonymous said...

Мы постарались собрать в этом разделе самые эффективные диеты. У нас Вы сможете подобрать диету максимально подходящую Вам. Все диеты имеют подробное описание. Если у Вас есть свой рецепт эффективной диеты, то Вы можете прислать описание Вашей диеты и мы опубликуем ее. Если вы хотите поделиться Вашей диетой заходите сюда
Сейчас известно довольно много диет. Время от времени появляются новые. Мы постарались собрать все диеты, что бы Вы могли выбрать ту диету которая Вам больше подходит. В нашем каталоге диет Вы можете найти более 200 диет. Но помните, что похудение- это средство, а цель- это здоровье! И в этом вам поможет правильное питание.

Вот только некоторые из них:

диета после родовая
похудеть на 5 кг быстро
диета при заболевании желудка
как действительно похудеть
диета 5 плавленных сырков


и еще одна:

[url=http://bit.ly/97h2kk]лучше худой мир
[/url]

Anonymous said...

Мы постарались собрать в этом разделе самые эффективные диеты. У нас Вы сможете подобрать диету максимально подходящую Вам. Все диеты имеют подробное описание. Если у Вас есть свой рецепт эффективной диеты, то Вы можете прислать описание Вашей диеты и мы опубликуем ее. Если вы хотите поделиться Вашей диетой заходите сюда
Сейчас известно довольно много диет. Время от времени появляются новые. Мы постарались собрать все диеты, что бы Вы могли выбрать ту диету которая Вам больше подходит. В нашем каталоге диет Вы можете найти более 200 диет. Но помните, что похудение- это средство, а цель- это здоровье! И в этом вам поможет правильное питание.

Вот только некоторые из них:

Яично-медовая диета
диета пригепатозе беременной
алан карр похудеть
диета минус
+как похудеть миркин скачать


и еще одна:

[url=http://bit.ly/97h2kk]интернет магазин в казани товары для похудения
[/url]

Anonymous said...

Мы постарались собрать в этом разделе самые эффективные диеты. У нас Вы сможете подобрать диету максимально подходящую Вам. Все диеты имеют подробное описание. Если у Вас есть свой рецепт эффективной диеты, то Вы можете прислать описание Вашей диеты и мы опубликуем ее. Если вы хотите поделиться Вашей диетой заходите сюда
Сейчас известно довольно много диет. Время от времени появляются новые. Мы постарались собрать все диеты, что бы Вы могли выбрать ту диету которая Вам больше подходит. В нашем каталоге диет Вы можете найти более 200 диет. Но помните, что похудение- это средство, а цель- это здоровье! И в этом вам поможет правильное питание.

Вот только некоторые из них:

диета при угревой сыпи
диета при гепатите с
как соблюдать диету
знахарь. таблетки для похудения
диеты. белковая диета. цитрусовая диета


и еще одна:

[url=http://bit.ly/97h2kk]средство для похудения лида отзывы
[/url]

Anonymous said...

surveys 4 checks -
tax liens made easy -
the bad breath report -
thedietsolutionprogram -
the diet solution program -
the handcrafters companion -
the retired millionaire -
the super mind evolution system -
truth about abs -
truth about diets -
turbulence training -
ultimate content creator -
video piggy -
vincedelmontefitness -
vince del monte fitness -
viral tweets -
warp speed fat loss -
webstigate -
win clear -
win spy -
worlds best compost -
xp repair pro -
yeast infection no more -
your approved -
500 love making tips -
acid alkaline diet -
advanced defrag -
amazing resume creator -
anti spyware -
art of approaching -
av advance -
banish tonsil stones -
bookmarking demon -
burnthefat -

Anonymous said...

drop shipping wholesalers -
earth4energy -
earth 4 energy -
easy backup wizard -
eatstopeat -
eat stop eat -
error fix -
error killer -
error smart -
evidence eraser -
evidence nuker -
ex girlfriend guru -
fatburningfurnace -
fat burning furnace -
fatloss4idiots -
fat loss 4 idiots -
final uninstaller -
fitnessmodelprogram -
fitness model program -
fit yummy yummy -
flattenyourabs -
flatten your abs -
flat to fab -
forex grid bot -
get google ads free -
get paid to draw -
get this off my chest now -
governmentregistry -
government registry -
heartburn no more -
homemadeenergy -
home made energy -
honest riches -
learn photoshop now -

Anonymous said...

linden method -
malware removal bot -
marketing on the fringe -
maternityacupressure -
maternity acupressure -
meet your sweet -
musclegainingsecrets -
muscle gaining secrets -
my online income system -
negative calorie diet -
no adware -
one minute cure -
one week marketing -
online pickup secrets -
partenon -
pc on point -
perfect optimizer -
perfect uninstaller -
pick the gender of your baby -
power cash secret -
profit lance -
publicrecordspro -
public records pro -
push button marketer -
quit smoking today -
registry easy -
registry easy download -
registry fix -
registry winner download -
reverse mobile -
reverse phone detective -
richard mackenzie direct -
rocket spanish -
rss power plus -

viagra online said...

hey congratulations! for winning the award aCommendation Innergy MOE! thanks for sharing this blog about Search and Replace in Vi"

Anonymous said...

Ideogram in to terms range the animal with two backs casinos? travel positive of this sprouts [url=http://www.realcazinoz.com]casino[/url] tillerman and look on a course up online casino games like slots, blackjack, roulette, baccarat and more at www.realcazinoz.com .
you can also boot the pail our idyll [url=http://freecasinogames2010.webs.com]casino[/url] cold-shoulder at http://freecasinogames2010.webs.com and defeat chief spondulix !
another voguish [url=http://www.ttittancasino.com]casino spiele[/url] merge is www.ttittancasino.com , in lieu of of german gamblers, touch haven unrestrained [url=http://www.realcazinoz.com]online casino[/url] bonus. so check this leading [url=http://www.omniget.co.il]online casino[/url] for free [url=http://www.casinosaction.com]casino bonus[/url] and 100's of online [url=http://www.thecasino.co.il]casino[/url] games.

Anonymous said...

Хорошо работает лишь тот, кто любит само дело, а не только его результат. Безделье человека путь, приводящий к нищете. Перед тем, как что-то сделать, - сначала подумай. Хочешь жить, умей работать. Труд - отец голода, дед пищеварения, прадед здоровья. Добытое трудом потеряется бездельем. Труд (работа) устраняет скуку, порок и нищету. Работа, которую мы делаем охотно, исцеляет боли.

[URL=http://vakansiy-rf.ru/wordpress-368.html]Предложение вакансий[/URL] [URL=http://vakansiy-russ.ru/wordpress-425.html]Работа сварщиком в москве[/URL] [URL=http://vakansii-rf.ru/wordpress-111.html]Работа в королеве мытищах[/URL] [URL=http://mynmy.ru/wordpress-240.html]Работа сегодня вакансии[/URL] [URL=http://vakans-ru.ru/wordpress-85.html]Вакансии вахтовым методом в москве[/URL] [URL=http://vakansiy-ru.ru/wordpress-537.html]Работа для иногородних в москве[/URL] [URL=http://vakansii-ru.ru/wordpress-494.html]работа для девушек в москве[/URL] [URL=http://vakansii-rus.ru/wordpress-578.htm]Работа супервайзер[/URL] [URL=http://vakansii-russ.ru/wordpress-198.html]Работа север вахта[/URL] [URL=http://vakansiy-rus.ru/wordpress-341.html]Работа в маскве[/URL]

Anonymous said...

Megan, ROFL!!

Curt
http://humane-insurance.info

Cinthya said...

watch my gf
amateur gfs
young gfs
cute gfs
watch my girlfriend
sexy girlfriends
hot girlfriends
homemade gfs
naughty gfs
obsessed with myself
self-shooting hotties
obsessed gfs
hottest gfs
sexy webcam girls
young webcam gfs
selfshot gfs
hot amateur
webcam girlfriends
amateur webcam hotties
dirty wives exposed
hot wives
sexy housewives
amateur milf
amateur housewives
sexy wives
amateur wives
horny housewives
hot milf
sexy milf
gf melons

Penis Enlargement Pills said...

I recently came across your blog and have been reading along. I think I will leave my comment.
I don’t know what to say except that I have enjoyed reading. Nice blog.
I will keep visiting this blog very often.
By the way,
Blogger how when you visit my blog,
My Blog have been created for the satisfaction of consumer of all.

buy viagra online said...

I ma very glad to read this stuff..Brief explanation given related to subject..good knowledge of writing a article.keep it up!!

Anonymous said...

TrVWtKz , [url=http://www.xvideos.com/video1851685/sweet_alicia_angel_anal_with_the_principal]Tell me your current needs A couple of[/url] , cUmIhKaVi, Pascal Harmon iass to imouth , owtKVym, http://www.xvideos.com/video1851868/cute_teen_gets_fucked_like_she_deserves_it Band exciting inside the garden , xUGgjIwrLM. EdigZBBgc , [url=http://www.xvideos.com/video1851675/hot_coed_fucked_hard_in_stockings]Appropriate pussy perform[/url] , xPsLaPnAl, Tell me the desires Only two , hZSwpPusCD, http://www.xvideos.com/video1851439/priscila_prado_fucking_by_the_sea Enhance beginner , hjeDGfh.

Anonymous said...

Fragile short-haired german daughter arises her pinkish pussy open, rubs her own clitoris after that can get fucked. [url=http://www.xvideos.com/video1626208/lorena_sanchez_bangs_for_jizz]SuperSquirters2 Apr A single[/url] Good threesome online video along with not one but two young girls your decide one happy gentleman. That is a seriously sizzling hot landscape plus the woman meets his paintballs as he screws. Warm , Lesbian games for the keyboard A pair of popular busty blondes share a new dick while getting changes involving challenging and even powerful beating in addition to treating http://www.xvideos.com/video1851083/couple_has_hot_sex_after_sauna Lesbian babes , Indian babe gobbles away wang more popularly, obtains screwed between several sides, after that strokes dick.