[an error occurred while processing this directive] [an error occurred while processing this directive][an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive] (none) [an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive][an error occurred while processing this directive] [an error occurred while processing this directive][an error occurred while processing this directive] [an error occurred while processing this directive][an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive] (none) [an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive][an error occurred while processing this directive]
 
[an error occurred while processing this directive] [an error occurred while processing this directive]
Skåne Sjælland Linux User Group - http://www.sslug.dk Home   Subscribe   Mail Archive   Forum   Calendar   Search
MhonArc Date: [Date Prev] [Date Index] [Date Next]   Thread: [Date Prev] [Thread Index] [Date Next]   MhonArc
 

Re: [NOVICE] slette [] med sed ??



On Mon, 24 Jul 2000 09:01:30 +0200, Kasper Edwards wrote:
>
>Hvordan for man sed til at slette et ord i klammer som: [TEST] ??
>
>Forsøg som:
>sed s/TEST// minfil.log 
>	virker men [] bliver tilbage

Fordi du un erstatter TEST ikke [ og ], men det ved du nok :-)

>
>sed s/[TEST]// minfil.log
>	får sed til at slettet det første T så der står [ETS]

[TEST] betyder _enten_ T, E, S (eller T).
Hvis du kigger filen igennem, så mangler alle T'er, E'er og S'er.

>
>sed s/[]// minfil.log
>	Giver en fejl

Fordi [xyz] angiver en række muligheder. Her angiver du dog ikke nogen,
så det giver ikke rigtig mening.

Alle specielle tegn (bla. andet altså [ og ]) kan i reg. expr. quotes med
'\' så de ikke har speciel betydning længere.

Man skulle så tro, du kunne skrive:
sed s/\[TEST\]// minfil.log

Men det virker ikke ved mig. Det har samme indvirkning som s/[TEST]// .
Jeg aner ikke hvorfor, men dette virker til gengæld:

sed s/\\[TEST]// minfil.log

Håber det hjalp dig... Og hvis en eller anden der er klogere end mig (dem er
der jo nok et par stykker af :-) kunne forklare hvorfor den ekstra '\' skal
være der, kunne de så ikke forklare det?

>
>
>Ps. jeg bruger RH6.1
>
>
>Mvh.
>Kasper
>


-- 
	Peter Seidler


 
Home   Subscribe   Mail Archive   Index   Calendar   Search

 
 
Questions about the web-pages to <www_admin>. Last modified 2005-08-10, 20:59 CEST [an error occurred while processing this directive]
This page is maintained by [an error occurred while processing this directive]MHonArc [an error occurred while processing this directive] # [an error occurred while processing this directive] *