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

Unix- Scp

scp user@host:/export/home/uzakdizin/dosya.txt /export/home/yigit/lokaldizin/

30 Eylül 2013 Pazartesi

Unix - İki dosyanın ortak satırları

perl -ne 'print if ($seen{$_} .= @ARGV) =~ /10$/'  file1 file2

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:


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. 

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

Unix - dosya encoding öğrenme

file -bi test.txt

25 Aralık 2012 Salı

Solaris - ps -ef

/usr/ucb/ps auxvv

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.

19 Aralık 2012 Çarşamba

Find - Exclude filetype

find . -type f \( ! -iname "*.log" \) | xargs grep -is "10.90.11.79"

12 Aralık 2012 Çarşamba

Unix - Uname

uname -a
sistem bilgisi

20 Kasım 2012 Salı

Unix'te Ant targetini çalıştırmak

ant "FULLJARCOPY" -f build.xml

2 Kasım 2012 Cuma

Unix - Komut tarihi

more ~/.bash_history

15 Ekim 2012 Pazartesi

Unix - Dosya izinlerini klonlamak

chmod --reference=otherfile thisfile

31 Temmuz 2012 Salı

Unix - Dosya isminde Case-insensitive arama

 find / -iname ".movies"

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 ..

Unix - Dosyanın satırlarını numaralandırmak

cat a.txt -n
nl a.txt -ba

boş satırları hariç:
nl a.txt

12 Temmuz 2012 Perşembe

Unix - Cut

boşluk karakterinin ayırdığı string parçalarından ilki:
cat dosya | cut -d" " -f1

Unix - Uniq komutu


Satır histogramı:
uniq -c dosya

mükerrer satırlar:
uniq -d dosya

11 Temmuz 2012 Çarşamba