Unix, Linux, JBoss, Websphere, Ant, Python, Oracle DB, Arduino, Raspberry Pi.
unix etiketine sahip kayıtlar gösteriliyor. Tüm kayıtları göster
unix etiketine sahip kayıtlar gösteriliyor. Tüm kayıtları göster
16 Nisan 2014 Çarşamba
30 Eylül 2013 Pazartesi
21 Haziran 2013 Cuma
Unix shell scripting - Log yazma fonsiyonu
Log-function
In a private message, I was asked how the log-function worked that I described above. Since this might be helpful to other people too, I'm answering the question in public.
First of all, I use Bash, don't know if this trick works in other Shells.
Content of script:
First of all, I use Bash, don't know if this trick works in other Shells.
Content of script:
Code:
#!/bin/bash . lib/functions.conf # mind the SPACE between the DOT and the path/filename!!! logfile=scheduler.log func_eventlog "STARTING ABG JOB" -=script runs some more, but that's irrelevant, the example is clear=-
Content of file: lib/functions.conf which by the way is executable :
Code:
################################################ # # # Log functie # # # # Usage: # # # # func_eventlog "Dit wil ik loggen" # # # # Variabelen: # # # # $logfile (logfile inclusief pad) # # # ################################################ func_eventlog() { echo -e "`date` - $1" >> $logfile }
So whenever I want something logged, I just use:
func_eventlog "Send this text to logfile"
and I never ever have to worry about accidentally overwriting my logs instead of appending to them.
22 Mayıs 2013 Çarşamba
7 Nisan 2013 Pazar
Unix - Grep'te grepi almamak
http://www.cyberciti.biz/tips/grepping-ps-output-without-getting-grep.html
21 Mart 2013 Perşembe
25 Aralık 2012 Salı
21 Aralık 2012 Cuma
Unix - Değiştirilme tarihini değiştirme
touch -t 8604210000 a.txt
a.txt'nin değiştirilme tarihini 21.04.1986 00:00 olarak değiştirir.
a.txt'nin değiştirilme tarihini 21.04.1986 00:00 olarak değiştirir.
19 Aralık 2012 Çarşamba
12 Aralık 2012 Çarşamba
20 Kasım 2012 Salı
2 Kasım 2012 Cuma
Unix - Komut tarihi
more ~/.bash_history
Etiketler:
.bash_history,
history,
unix,
unix sistem dosyaları
15 Ekim 2012 Pazartesi
31 Temmuz 2012 Salı
27 Temmuz 2012 Cuma
Unix - Awk histogram
her bir satırda, kaç tane e karakteri olduğunu gösteren histogram.
awk -v FS="" '
BEGIN{print"count\tlinenum"}
{cnt=0;for (i=1;i<=NF;i++) if ($i=="e") cnt++; print cnt"\t"NR}' input.dat
13 Temmuz 2012 Cuma
Unix - Dosyayı bölmek
dosyayı 3000 bytelık parçalara bölmek:
split -b 3000 essay.txt parca_
dosyayı 30 satırlık parçalara bölmek:
split -l 30 essay.txt parca_
oluşan dosyalar: parca_aa, parca_ab ..
split -b 3000 essay.txt parca_
dosyayı 30 satırlık parçalara bölmek:
split -l 30 essay.txt parca_
oluşan dosyalar: parca_aa, parca_ab ..
12 Temmuz 2012 Perşembe
11 Temmuz 2012 Çarşamba
Kaydol:
Kayıtlar (Atom)