[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] Det ender altid med en....



JesperKP wrote:

> Den 25-03-2011 07:59, Henrik Pedersen skrev:
>> Henrik Pedersen wrote:
>>
>>> Kim Schulz wrote:
>>>
>>>> On Tue, 22 Mar 2011 07:14:33 +0100
>>>> Henrik Pedersen<sslug@sslug>  wrote:
>>>>
>>>>> Robert Larsen wrote:
>>>>>
>>>>>> -----BEGIN PGP SIGNED MESSAGE-----
>>>>>> Hash: SHA1
>>>>>>
>>>>>> On 2011-03-21 22:22, Henrik Pedersen wrote:
>>>>>>> Konkret drejer det sig om at der bliver uploadet en stærkt M$
>>>>>>> påvirket fil. Jeg smider den derefter igennem adskillige sed kald,
>>>>>>> der klargør den
>>>>>> til at
>>>>>>> blive smidt i en db.
>>>>>>>
>>>>>>> Som emnet angiver er problemet at jeg kun for dele af resultatet
>>>>>>> tilbage, kun den første linie.
>>>>>>>
>>>>>>> Er der nogen der har en ide om hvor hunden kan ligge begravet.
>>>>>>>
>>>>>>> \Henrik
>>>>>> Du skal nok bruge exec() istedet.
>>>>>> Anden argument er et array som bliver udfyldt med linjerne, som din
>>>>>> kommando outputter.
>>>>>>
>>>>>> Dem kan du så joine med implode() funktionen, hvis du hellere vil
>>>>>> have én newline separeret streng.
>>>>>> -----BEGIN PGP SIGNATURE-----
>>>>>> Version: GnuPG v1.4.10 (GNU/Linux)
>>>>>> Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/
>>>>>>
>>>>>> iEYEARECAAYFAk2Hzo4ACgkQzDMeisFqGZYJJQCgpiGlOasgCfttlj+NyR4NpDcs
>>>>>> itUAnisE6c179R1ghenFYuCrT1cpAkyh
>>>>>> =RTB2
>>>>>> -----END PGP SIGNATURE-----
>>>>> Har prøvet såvel exec() som shell_exec med samme resultat.
>>>>> Har også prøvet fopen for tmp filen og den bliver ganske rigtig
>>>>> indlæst i variablen, men samme resultat, altså kun første linie
>>>>> retur, når den sendes igennem bash scriptet.
>>>>> For god ordens skyld er her de sed kommandoer det sendes igennem.
>>>>>
>>>>>    sed 's_</td><td style.*">_"\n"_g'<$1 | sed 's_</td><td>_";"_g' | \
>>>>>    sed 's_</td>[^>]*">_";"_g' | sed 's_<td x[^>]*>_\n"_g' | sed
>>>>> 's_<[^>]*>__g' | \
>>>>>    sed '1d'
>>>>>
>>>>> Det ville selvfølgelig være cool hvis php selv kan klare det, men den
>>>>> vil ikke rigtig makke ret når der skal fjernes html-tags.
>>>>> \Henrik
>>>>
>>>> Har du prøvet med strip_tags() ?
>>>> http://php.net/manual/en/function.strip-tags.php
>>>>
>>>> har virket fint for mig ved mange lejligheder.
>>>>
>>>> kim
>>> strip_tags løser desværre ikke opgaven.
>>> Som sed'en antyder så er der flere manøvre der skal udføres, og ikke
>>> blot fjernes tags.
>>>
>>> \Henrik
>>
>> .... linie perl eller to :-)
>> PHP har åbenbart nogle issues med at pipe stdin/out, så det endte som
>> sagt med en implementering i perl, dog ikke en oneliner.
>> Tak for hjælpen
>>
>> \Henrik
> 
> Virkede det heller ikke hvis du lod være med at bruge alle de pipes og
> brugte sed's egen
> 
>    sed -e 'yada' -e 'yada1' -e'yada2'
> 
> Så du var helt fri for at pipe
> 
> Mvh
> JesperKP

Det løste det heller ikke.
Jeg mistænker lidt at det er relateret til længden af linien.
M$ filen er på 48 KB i en linie.

\Henrik


 
Home   Subscribe   Mail Archive   Index   Calendar   Search

 
 
Questions about the web-pages to <www_admin>. Last modified 2011-04-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] *