GoFuckYourself.com - Adult Webmaster Forum

GoFuckYourself.com - Adult Webmaster Forum (https://gfy.com/index.php)
-   Fucking Around & Business Discussion (https://gfy.com/forumdisplay.php?f=26)
-   -   quick vi problem :| (search and replace) (https://gfy.com/showthread.php?t=525081)

a1ka1ine 10-06-2005 02:51 PM

quick vi problem :| (search and replace)
 
im trying to search and remove all instances of "../"

im using %s@../@@gc but its not doing it.. anyone use this program? its fucking voodoo to me :)

FuqALot 10-06-2005 02:55 PM

http://kb.iu.edu/data/acoj.html

or

http://www.google.com/

a1ka1ine 10-06-2005 02:56 PM

Quote:

Originally Posted by FuqALot

this does not help my problem, but thanks for trying! believed me i used a search engine for 30 minutes and read pages of vi manuals with no success

FuqALot 10-06-2005 02:57 PM

Ok hehe.. you can always open it in pico too, it's an easier editor. vi is kinda outdated

try: pico file.txt

FuqALot 10-06-2005 02:58 PM

Wait, you want to do ../ right, maybe you should add a backslash in front of the slash, or maybe you should try [../]

a1ka1ine 10-06-2005 02:59 PM

Quote:

Originally Posted by FuqALot
Ok hehe.. you can always open it in pico too, it's an easier editor. vi is kinda outdated

try: pico file.txt

thanks again heh, but the version of pico installed does not do replace for some reason :| and the box doesnt have the right glib library for the newer version and im not messing about with installing stuff i dont know about on a live server :S :)

FuqALot 10-06-2005 03:05 PM

See, in perl i would have either used the backslash idea or the [../] idea. If they don't do anything, then try: s^../^^g

if that doesnt do anything then you should get the file to notepad and do it there, but that might leave windows newlines you don't want hehe.

a1ka1ine 10-06-2005 03:06 PM

trying what you suggested now :)

a1ka1ine 10-06-2005 03:09 PM

Quote:

Originally Posted by FuqALot
See, in perl i would have either used the backslash idea or the [../] idea. If they don't do anything, then try: s^../^^g

if that doesnt do anything then you should get the file to notepad and do it there, but that might leave windows newlines you don't want hehe.

swapping out the delimiter is what i tried, and for some reason it finds every occurance of / and not the ../ before it.


damn voooddooooooooo :S.

!!! i will keep googling :)

willysbirthday 10-06-2005 03:10 PM

:1,$s/\.\.\///g

willysbirthday 10-06-2005 03:10 PM

. is wildcard, it must be escaped
/ is special char, it must be escaped

FuqALot 10-06-2005 03:12 PM

That's probably since a '.' is usually preserved for something too... that's why I suggested [../] instead of ../, which is the way to go with perl hmm.. i have no idea then.

a1ka1ine 10-06-2005 03:16 PM

Quote:

Originally Posted by willysbirthday
:1,$s/\.\.\///g

oh shit - that worked perfectly! thanks! i had no idea a . was also a special character there.. thanks for the help :)

FuqALot 10-06-2005 03:17 PM

yay. hehe well.. close :D.

a1ka1ine 10-06-2005 03:18 PM

Quote:

Originally Posted by FuqALot
That's probably since a '.' is usually preserved for something too... that's why I suggested [../] instead of ../, which is the way to go with perl hmm.. i have no idea then.

oh well. thanks for helping, and making this the longest thread on gfy about vi - we are setting history! :winkwink: :1orglaugh

MrHits 10-06-2005 03:18 PM

forget it.. someone already posted it .


doh


All times are GMT -7. The time now is 10:37 AM.

Powered by vBulletin® Version 3.8.8
Copyright ©2000 - 2026, vBulletin Solutions, Inc.
©2000-, AI Media Network Inc123