The UNIX and Linux Forums  

Go Back   De Unix-en Linux Forum > Top Forums > UNIX voor Dummies Questions & Answers
.
google unix.com



UNIX voor Dummies Questions & Answers Als u niet zeker weet waar je een Unix-of Linux vraag, post het hier. Alle UNIX-en Linux beginners van harte welkom!!

Meer UNIX en Linux Forum Onderwerpen Misschien vindt u Helpful
Draad Thread Starter Forum Antwoorden Last Post
Induceren ruilt op Solaris dangral SUN Solaris 2 03-06-2008 06:12 PM
Swapping Esaia SuSE 3 06-11-2006 05:09 PM
hoe je ruilt info leo UNIX voor Dummies Questions & Answers 2 05-06-2004 05:30 PM
Semafoondiensten en Swapping ST2000 Bestandssystemen, schijven en geheugen 2 04-30-2004 03:47 PM
Swapping vragen 98_1LE UNIX voor Dummies Questions & Answers 1 08-07-2001 12:43

Reply
English Japanese Spanish French German Portuguese Italian Dutch Swedish Russian Norwegian Hungarian Hebrew Danish Bulgarian Greek Powered by Powered by Google
 
LinkBack Thread Tools Zoeken in deze Thread Rate Thread Display Modes
  #1 (permalink)  
Old 06-24-2009
Jahn Jahn is offline
Geregistreerde gebruiker
  
 

Join Date: mei 2009
Posten: 9
Swapping in VI

Hoi,

Ik probeer verschillende gelijkaardige woorden te vervangen door een ander woord in vi. Hier is wat ik heb geschreven voor het script:

3dTcat-prefix SuperBrik_4WAY_HRF ../JULY10_2007A/results2TENT/stats.JULY10_2007A + TLRC ../JULY10_2007G/results2TENT/stats.JULY10_2007G + TLRC ../JULY10_2007I/results2TENT/stats.JULY10_2007I + TLRC ../JULY11_2007F/results2TENT/stats.JULY11_2007F + + TLRC ../JULY11_2007J/results2TENT/stats.JULY11_2007J TLRC ../JULY12_2007A/results2TENT/stats.JULY12_2007A + TLRC ../JULY12_2007B/results2TENT/stats.JULY12_2007B + TLRC ../JULY12_2007I/results2TENT/stats.JULY12_2007I + TLRC ../JULY12_2007J/results2TENT/stats.JULY12_2007J + TLRC ../JUNE13_2007A/results2TENT/stats.JUNE13_2007A TLRC ../JUNE13_2007B/results2TENT/stats.JUNE13_2007B + + TLRC ../JUNE13_2007C/results2TENT/stats.JUNE13_2007C + TLRC .. / JUNE13_2007E/results2TENT/stats.JUNE13_2007E + TLRC ../JUNE13_2007G/results2TENT/stats.JUNE13_2007G + TLRC ../JUNE13_2007I/results2TENT/stats.JUNE13_2007I + TLRC ../JUNE14_2007D/results2TENT/stats.JUNE14_2007D + TLRC ../JUNE14_2007H / results2TENT/stats.JUNE14_2007H + TLRC ../JUNE15_2007A/results2TENT/stats.JUNE15_2007A + TLRC


Wat ik wil doen is vervanging van de "stats.J * + TLRC" met "displayBriks". Ik ben bekend met het gebruik van de: s / opdracht te zoeken en vervangen meerdere identieke woorden, maar ben niet zeker van hoe dit te doen voor een reguliere expressie in vi. Enig idee over waar te beginnen?

Bedankt,

-Jahn
  #2 (permalink)  
Old 06-24-2009
fpmurphy's Avatar
fpmurphy fpmurphy is online now Forum Staff  
Moderator
  
 

Join Date: december 2003
Locatie: Florida
Berichten: 1.938
Misschien een voorbeeld zou helpen. Stel, je hebt de volgende tekst bestand

Code:
abcdefg
faaaag
accxxcck
abbde

en u wilt gebruiken vi te zoeken en vervangen van alle gevallen van 'b', 'c', 'd' en 'e' met 'Q',
u kunt doen met het volgende commando ":% s / [be] / Q / g 'die resulteert in

Code:
aQQQQfg
faaaag
aQQxxQQk
aQQQQ

Hier is een uitzondering van een typisch vi man pagina voor vervangingsproducten:

Code:
    [range] s[ubstitute] [/pattern/replace/] [options] [count] [flags]
    [range] & [options] [count] [flags]
    [range] ~ [options] [count] [flags]
        Make substitutions. In the substitution string, the characters ~ and %
        may have special meanings. If the entire replace pattern is a percent
        sign (%), the previous replacement pattern is used. (This can be
        useful for repeating substitutions that contain back references.) The
        special character ~ inserts the previous replacement string into this
        replacement string.
        The options can be any of the following:

        c
            Ask for confirmation before replacing the text.

        g
            Perform the replacement on all occurrences of the regular
            expression on the line.

        r
            If no regular expression was specified, use the most recent
            regular expression (used for a search) rather than the same
            regular expression as used for the last substitute command.

Reply

Bladwijzers

Thread Tools Zoeken in deze Thread
Zoeken in deze Thread:

Uitgebreid zoeken
Display Modes Beoordeel deze draad
Beoordeel deze draad:

Posting Regels
Jij mag niet Post Nieuwe threads
Jij mag niet na antwoorden
Jij mag niet post attachments
Jij mag niet bewerk uw berichten

BB code is Aan
Smilies zijn Aan
[IMG] code Aan
HTML-code is Uit
Trackbacks zijn Aan
Pingbacks zijn Aan
Refbacks zijn Aan




Alle tijden zijn GMT -4. Het is nu 11:10.


Powered by: vBulletin, Copyright © 2000 - 2006, Jelsoft Enterprises Limited. Vertalingen Powered by .
vBCredits v1.4 Copyright © 2007 - 2008, PixelFX Studios
De Unix-en Linux Forums Copyright © 1993-2009. Alle rechten Reserved.Ad Beheer door RedTyger

Content Relevante URL's door vBSEO 3.2.0