[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: [PROGRAMMERING] sh script



Christian Pagh wrote:
> Jeg er netop begyndt at lave et sh script, som skal hente
> information ud af en tekst til.

Hvorfor vil du bruge sh?
I perl ville det være noget i retning af:
(helt uafprøvet)

$/=undef;
$file=`cat fil`;
($info)= $file =~ m|<info>(.*?)</info>|i;

Først omdefineres linie separatoren $/ således at
disse ikke skaber bøvl.

Dernæst læses indeholdet af filen ind i $file.
Bemærk at det er back-ticks og ikke blot '.

Til sidst ekstraheres teksten du ønsker fra filen
vha. et regulært udtryk.

Med et programmeringssprog med support for XML-DOM
burde det være endnu lettere at ekstrahere din streng.

-- 
  Mvh. Carsten Svaneborg
http://gauss.ffii.org


 
Home   Subscribe   Mail Archive   Index   Calendar   Search

 
 
Questions about the web-pages to <www_admin>. Last modified 2005-09-01, 02:01 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] *