вторник, 14 февраля 2012 г.

Linux febr.14 a

grep = mekle failu satura
echo 123 > num.dat ; echo qwe > chars.dat; echo QWE > CHARS.dat
grep "qwe" *.dat
grep -R "qw" *
grep -R "qw" /tmp/*
grep -Rs "qw" /tmp/*
grep -Rsi "qw" *
chars.dat:qwe
CHARS.dat:QWE

[a-z] klasifikators + kvantifikators

grep -RsiP "[a-z]+" *.dat
chars.dat:qwe
CHARS.dat:QWE

grep -isP "[a-z0-9._-]+@[a-z0-9.-_]+\.[a-z]{2,6}" *
jurijs@lv.lv

grep -isPn "[a-z0-9._-]+@[a-z0-9.-_]+\.[a-z]{2,6}" *
mail.txt:1:jurijs@enotars.lv

sudo ls -lR | grep "txt"
-rw-r--r-- 1 root root   18 2012-02-14 14:20 mail.txt

less /etc/passwd

grep -i "root"  /etc/passwd
root:x:0:0:root:/root:/bin/bash

grep -in "root"  /etc/passwd
1:root:x:0:0:root:/root:/bin/bash
-------------------------------------------------------------------------
#!/bin/bash
name=$1

grep $name /etc/passwd

if [ $? -eq 0 ]
then
        echo "$name ir atrasts"
else
        echo "$name nav atrasts"
fi
--------------
















Комментариев нет:

Отправить комментарий