kano ta prota mou bimata....boithiste me parakalo
Yannis Kotsinos
zookie at med.auth.gr
Sun Mar 30 23:25:02 EEST 2003
On Sunday 30 March 2003 15:15, Aleksandros Paleos wrote:
> Exo faei olo to proi prospathontas na grapso ena script file to opoio na
> antistrefei ta periexomena enos arxeiou kai na ta apothikeyei se ena allo
> Kateliksa se ayto to script file
>
>
> i=100 #tha prepei to arxeio dystyxos me mikrotero megethos apo 100 grammes
> while (test $i -gt 1)
> do
> #echo $i
> i=` expr $i - 1`
> tail +$i $1|head -1 >>$2 #epilegete kathe fora mono mia grammi
> done
>
> Opos mporeite na deite ektelo mia epanalipsi i opoia kathe fora epilegei
> mia grammi ksekinontas apo 100 pros ta pano apo ti thesi 100 kai paei pros
> to 1. Oso kai ean fainetai parakseno ayto douleyei giati ean to arxeio mas
> den exei 100 grammes tote to tail +100 den epistrefei tipota........
> Bebaia prospatho na bro enan tropo na metrao tis grammes tou protoy arxeiou
> gia na ekteleitai mono toses fores i epanalipsi.......
> prospathisa na grapso kati se
> a=` expr wc -l file` alla den mou doulepse...Ara me poion tropo mporo na
> metriso tis grammes enos arxeiou?
Sto poly kalo biblio "UNIX Programming Environment" (to opoio sto synistw
anepifylakta an kai palio shmera), sthn ellhnikh ekdosh poy exw egw, anaferei
(apo mnhmhs) oti einai kalo na doyleyoyme me to shell mesa sta oria twn
logikwn dynatothtwn toy. Nomizw pws to parapanw poy zhtas isws kai na
3efeygei apo aytes. Me thn tail (1) kai me thn head (1) px. den ginetai giati
an dwseis px. head -n 5 8a soy bgalei kai tis 5 prwtes grammes oxi mono thn
5mpth. Kalo reference gia shell programming (pera apo ayto to biblio poy soy
eipa) 8a breis edw: http://www.tldp.org/guides.html. Katebase to "Advanced
Bash-Scripting Guide" kai kalo diabasma (mhn 3exnas omws oti polla apo ayta
einai bash-specific). Kai mhn 3exnas thn man :)
Sto 8ema mas twra, ayto poy 8es ginetai poly eykola an antilhf8eis oti mporei
na apodw8ei me ena stack data type (sthn glwssa ths epiloghs soy). Attached
8a breis ena biastiko programma poy egrapsa se C poy kanei ayto poy 8eleis.
Apla kane redirect to stdin kai to stdout giati bariemai. :) An tyxon den soy
kanei to line width (defined 1024) megalwse to.
compile me: gcc -o revlines r.c
run me: ./revlines < input.txt > output.txt
> Prospatho na grapso ena programma pou na emfanizei ta periexomena enos
> arxeiou mono ean to periexomeno toy einai megalytero apo 10 grammes
edw 8a se boh8hsei to wc. Paradeigma:
#!/bin/sh
# filename.sh [dir gia elegxo]
for i in `ls $1`
do
lines=`wc -l $1/$i | awk '{print $1}'`
if [ $lines -gt 10 ]; then
echo "-------------- $1/$i -------------"
cat $1/$i
fi
done
> Episis psaxno na bro enan tropo gia to pos mporo na emfanizo mono ta login
> names kai ta home direcotries ton xriston pou exoyn syndethei sto sistima
> mou kapia apopsi?
Ayto mporei na ginei eykola me ena script arkei prwta na deis thn wall (1) h
th who (1)
> Kai telos prospatho na bro enan tropo na stelno ena minima se osous xristes
> exoun kanei log in
see above.
> --
> Παλαιος Αλεξανδρος
> Φοιτητης ΤΕΙ Πληροφορικης Αθηνας
HTH. Kalh synexeia!
--
War is fun when you know you're not going to die.
Running FreeBSD 4.8-RC | mailto:zookie at med.auth.gr
10:43μμ up 2:13, 1 user, load averages: 0,04 0,02 0,00
-------------- next part --------------
A non-text attachment was scrubbed...
Name: r.c
Type: text/x-csrc
Size: 1199 bytes
Desc: not available
URL: <http://lists.hellug.gr/pipermail/linux-greek-users/attachments/20030330/67c7955c/attachment.c>
More information about the Linux-greek-users
mailing list