![]()
From: Ömer F. USTA (omerusta@gmail.com)
Date: Thu 09 Mar 2006 - 19:16:06 EET
Acele ile yazdigim kod asagida. calisacagina veya sizin isteginizi tam olarak
karsilayip karsilamayacagina emin degilim
asagidaki dosyayi cevir.c ismi ile kaydedin sonra
gcc cevir.c -o cevir.elf
komutu ile cevir.elf dosyasini olusturun sonra bu dosyaya
calistirilabilir izni verin
chmod a+x cevir.elf
sonra sayilari haricindekilerin silinecegi dosyanin kopyasini
deneme.gir ismi ile
kayit edin . ( bu dosya bildigimiz iso8859-9 kodlamasi ile kodlanmis olmalidir )
sonra ./cevir.elf yazip entere basin sizin dosyanin sadece rakamlarindan olusan
sekli deneme.cik dosyasinda olusmus olacaktir.
(Aceleye geldigi icin tam duzgun test edemedim )
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
int main(int argc, char *argv[])
{
FILE *ptr_my_in_file;
FILE *ptr_my_out_file;
int ch=0;
int sp_count=0;
if((ptr_my_in_file = fopen("./deneme.gir","r"))==NULL)
{
printf("Dosya acilamadi\n");
exit(EXIT_FAILURE);
}
if((ptr_my_out_file = fopen("./deneme.cik","w+"))==NULL)
{
printf("Dosya acilamadi\n");
exit(EXIT_FAILURE);
}
while((ch=fgetc(ptr_my_in_file))!=EOF)
{
if (ch >=48 && ch <=57)
{
fputc(ch,ptr_my_out_file);
sp_count=0;
}
else if (ch == 13 || ch == 10)
{
fputc(ch,ptr_my_out_file);
}
else if( ch == 32 )
{
if (sp_count ==0)
{
fputc(ch,ptr_my_out_file);
sp_count++;
}
}
}
fclose(ptr_my_in_file);
fclose(ptr_my_out_file);
return 0;
}
saygılarımla
Ömer Fadıl USTA
On 3/9/06, orkun <temiz@deprem.gov.tr> wrote:
> merhaba
>
> grep veya gvim le bir metin dosyasındaki
> rakam olmayan verileri silmek istersem ne
> yapmam gerekir ?
>
> saygılar
>
> Ahmet Temiz
>
> ______________________________________
> XamimeLT - installed on mailserver for domain @deprem.gov.tr
> Queries to: postmaster@deprem.gov.tr
> ______________________________________
> The views and opinions expressed in this e-mail message are the sender's own
> and do not necessarily represent the views and the opinions of Earthquake Research Dept.
> of General Directorate of Disaster Affairs.
>
> Bu e-postadaki fikir ve gorusler gonderenin sahsina ait olup, yasal olarak T.C.
> B.I.B. Afet Isleri Gn.Mud. Deprem Arastirma Dairesi'ni baglayici nitelikte degildir.
>
>
>
> _______________________________________________
> Linux mailing list
> Linux@liste.linux.org.tr
> http://liste.linux.org.tr/mailman/listinfo/linux
>
>
>
-- Ömer Fadıl USTA http://www.bilisimlab.com/
_______________________________________________
Linux mailing list
Linux@liste.linux.org.tr
http://liste.linux.org.tr/mailman/listinfo/linux
![]()