Author Topic: คำสั่ง find,awk,sed,grep ที่อาจจะเป็นประโยชน์ ไว้ใช้ในการ track ปัญหา  (Read 60972 times)

golfreeze

  • Administrator
  • Hero Member
  • *****
  • Posts: 2140
    • View Profile
    • นั่งสมาธิ สติปัฏฐานสี่ พาเที่ยววัด แนะนำวัด แจกcd ธรรมะฟรี
    • Email
You can use -mtime option. It returns list of file if the file was last accessed N*24 hours ago. For
example to find file in last 2 months (60 days) you need to use -mtime +60 option.

* -mtime +60 means you are looking for a file modified 60 days ago.
* -mtime -60 means less than 60 days.
* -mtime 60 If you skip + or - it means exactly 60 days.

So to find text files that were last modified 60 days ago, use
$ find /home/you -iname "*.txt" -mtime -60 -print

Display content of file on screen that were last modified 60 days ago, use
$ find /home/you -iname "*.txt" -mtime -60 -exec cat {} \;

Count total number of files using wc command
$ find /home/you -iname "*.txt" -mtime -60 | wc -l

You can also use access time to find out pdf files. Following command will print the list of all pdf
file that were accessed in last 60 days:
$ find /home/you -iname "*.pdf" -atime -60 -type -f

List all mp3s that were accessed exactly 10 days ago:
$ find /home/you -iname "*.mp3" -atime 10 -type -f

There is also an option called -daystart. It measure times from the beginning of today rather than
from 24 hours ago. So, to list the all mp3s in your home directory that were accessed yesterday,
type the command
$ find /home/you -iname "*.mp3" -daystart -type f -mtime 1
« Last Edit: มกราคม 23, 2011, 10:06:52 PM by golfreeze »

golfreeze

  • Administrator
  • Hero Member
  • *****
  • Posts: 2140
    • View Profile
    • นั่งสมาธิ สติปัฏฐานสี่ พาเที่ยววัด แนะนำวัด แจกcd ธรรมะฟรี
    • Email
##Check and find content of email
find ./ -type f -exec grep "487C2369.5070808@arc.net.my"; {} /dev/null \;

##Find text

ใช้ regular exp ช่วย
โดยจุดประสงค์เพื่อต้องการหา คำว่า ขึ้นต้องด้วยอะไรตาม และเชื่อมด้วย @ แล้วลงท้ายด้วยอะไรตาม ครับ

search = ^(.*).@.(.*)$

# copy file ยกเว้น 1 ไฟล์ครับ
find . -type f -prune ! -name <file to be not copied> -exec cp {} /path/to/newdir \;

#หา mail ที่ลงท้ายด้วย linchee และอยู่ใน path new
find ./ -type f | grep linchee | grep new | more

golfreeze

  • Administrator
  • Hero Member
  • *****
  • Posts: 2140
    • View Profile
    • นั่งสมาธิ สติปัฏฐานสี่ พาเที่ยววัด แนะนำวัด แจกcd ธรรมะฟรี
    • Email
#!/bin/sh

PATH=/usr/sbin:/sbin:/usr/bin:/bin
export PATH

HOME="/home/migrate"

cd {HOME}
if [ -s ${HOME}/email_list ]
then
while read path_old
do
test=`echo $path_old | cut -d \/ -f 2,3,4`
echo "Already copy $path_old /home/$test"
#cp $path_old /home/$test
done < ${HOME}/email_list
cat /dev/null > ${HOME}/email_list
else
exit
fi

golfreeze

  • Administrator
  • Hero Member
  • *****
  • Posts: 2140
    • View Profile
    • นั่งสมาธิ สติปัฏฐานสี่ พาเที่ยววัด แนะนำวัด แจกcd ธรรมะฟรี
    • Email
#free | cut -d " " -f
1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,28

#grep -L -r 'Subject: Shi' .

#find /home/gigi -name '*.c' -print | xargs grep 'hello' /dev/null

#sudo find / -type f -name *.jpg -exec cp {} . \;

find . -type f -size +10000 -exec ls -al {} \;
find . -atime +1 -type f -exec mv {} TMP \; # mv files older then 1 day to dir TMP
find . -name "-F" -exec rm {} \; # a script error created a file called -F
find . -exec grep -i "vds admin" {} \;
find . \! -name "*.Z" -exec compress -f {} \;
find . -type f \! -name "*.Z" \! -name ".comment" -print | tee -a
/tmp/list
find . -name *.ini
find . -exec chmod 775 {} \;
find . -user xuser1 -exec chown -R user2 {} \;
find . -name ebtcom*
find . -name mkbook
find . -exec grep PW0 {} \;
find . -exec grep -i "pw0" {} \;
find . -atime +6
find . -atime +6 -exec ll | more
find . -atime +6 -exec ll | more \;
find . -atime +6 -exec ll \;
find . -atime +6 -exec ls \;
find . -atime +30 -exec ls \;
find . -atime +30 -exec ls \; | wc -l
find . -name auth*
find . -exec grep -i plotme10 {};
find . -exec grep -i plotme10 {} \;
find . -ls -exec grep 'PLOT_FORMAT 22' {} \;
find . -print -exec grep 'PLOT_FORMAT 22' {} \;
find . -print -exec grep 'PLOT_FORMAT' {} \;
find . -print -exec grep 'PLOT_FORMAT' {} \;
find ./machbook -exec chown 184 {} \;
find . \! -name '*.Z' -exec compress {} \;
find . \! -name "*.Z" -exec compress -f {} \;
find /raid/03c/ecn -xdev -type f -print
find /raid/03c/ecn -xdev -path -type f -print
find / -name .ssh* -print | tee -a ssh-stuff
find . -name "*font*"
find . -name hpmcad*
find . -name *fnt*
find . -name hp_mcad* -print
find . -grep Pld {} \;
find . -exec grep Pld {} \;
find . -exec grep Pld {} \;
find . -exec grep PENWIDTH {} \; | more
find . -name config.pro
find . -name config.pro
find /raid -type d ".local_sd_customize" -print
find /raid -type d -name ".local_sd_customize" -print
find /raid -type d -name ".local_sd_customize" -ok cp
/raid/04d/MCAD-apps/I_Custom/SD_custom/site_sd_customize/user_filer_project_dirs {} \;
find /raid -type d -name ".local_sd_customize" -exec cp
/raid/04d/MCAD-apps/I_Custom/SD_custom/site_sd_customize/user_filer_project_dirs {} \;
find . -name xeroxrelease
find . -exec grep xeroxrelease {} \;
find . -name xeroxrelease
find . -name xeroxrelease* -print 2>/dev/null
find . -name "*release*" 2>/dev/null
find / -name "*xerox*" 2>/dev/null
find . -exec grep -i xeroxrelease {} \;
find . -print -exec grep -i xeroxrelease {} \;
find . -print -exec grep -i xeroxrelease {} \; > xeroxrel.lis
find . -exec grep -i xeroxrel {} \;
find . -print -exec grep -i xeroxrel {} \;
find . -print -exec grep -i xeroxrel {} \; | more
find /raid/03c/inwork -xdev -type f -print >> /raid/04d/user_scripts/prt_list.tmp
find . -exec grep '31.53' {} \;
find . -ls -exec grep "31/.53" {} \; > this.lis
find . -print -exec grep "31/.53" {} \; > this.lis
find . -print -exec grep 31.53 {} \; > this.lis
find . -exec grep -i pen {} /;
find . -exec grep -i pen {} \;
find . -print -exec grep -i pen {} \; | more
find . -exec grep -i pen {} \;
find . -atime +6 -exec ll | more \;
find . -atime +6 -exec ll \;
find . -atime +6 -exec ls \;
find . -atime +30 -exec ls \;
find . -atime +30 -exec ls \; | wc -l
find . \! -name '*.Z' -exec compress -f {} \;
find . -name 'cache*' -depth -exec rm {} \;
find . -name 'cache*' -depth -print | tee -a /tmp/cachefiles
find . -name 'cache[0-9][0-9]*' -depth -print | tee -a /tmp/cachefiles
find . -name 'hp_catfile' 'hp_catlock' -depth -print | tee -a /tmp/hp.cats
find . -name 'hp_catfile' -name 'hp_catlock' -depth -print | tee -a /tmp/hp.cats
find . -name 'hp_cat*' -depth -print | tee -a /tmp/hp.cats
find . -name 'hp_cat[fl]*' -depth -print | tee -a /tmp/hp.cats
find /raid -name 'hp_cat[fl]*' -depth -print
find . \! -name '*.Z' -exec compress -f {} \;
find . -name '*' -exec compress -f {} \;
find . -xdev -name "wshp1*" -print
find . -xdev -name "wagoneer*" -print
find . -name "xcmd" -depth -print
find /usr/contrib/src -name "xcmd" -depth -print
find /raid -type d -name ".local_sd_customize" -exec ls {} \;
find /raid -type d -name ".local_sd_customize" \
-exec cp /raid/04d/MCAD-apps/I_Custom/SD_custom/site_sd_customize/user_filer_project_dirs {}
\;

golfreeze

  • Administrator
  • Hero Member
  • *****
  • Posts: 2140
    • View Profile
    • นั่งสมาธิ สติปัฏฐานสี่ พาเที่ยววัด แนะนำวัด แจกcd ธรรมะฟรี
    • Email
##Count string + uniq word
less pop3d-ssl_list_grep_k | awk -F '@' '{print $2}' | sort | uniq -c | sort -n

##Check and find content of email
find ./ -type f -exec /bin/grep "487C2369.5070808@arc.net.my";; {} /dev/null \;

golfreeze

  • Administrator
  • Hero Member
  • *****
  • Posts: 2140
    • View Profile
    • นั่งสมาธิ สติปัฏฐานสี่ พาเที่ยววัด แนะนำวัด แจกcd ธรรมะฟรี
    • Email
###sed ในกรณีเขียน ให้เปลี่ยน ตัวแปรไปด้วย

#!/bin/sh

change="xxxx"

less xxx.txt | sed 's/xxxx/'$change'/g' > xxx_new.txt

================

ต้องใส่ เครื่องหมาย ' ' ในตัวแปรด้วยน่ะครับ เป็น '$change' แบบนี้ครับผม

golfreeze

  • Administrator
  • Hero Member
  • *****
  • Posts: 2140
    • View Profile
    • นั่งสมาธิ สติปัฏฐานสี่ พาเที่ยววัด แนะนำวัด แจกcd ธรรมะฟรี
    • Email
อย่างเช่น ถ้าเรา ต้องการ เปลี่ยน ข้อความในไฟล์ ใดไฟล์หนึ่งน่ะครับ เราสามารถใช้คำสั่ง sed
ช่วยได้ดังนี้ คือ

ต้องการเปลี่ยน config ในไฟล์ httpd.conf ในบันทัดที่เป็น DirectoryIndex
จาก index.html ไปเป็น index.php

เริ่มดังนี้ เลย สั่งที่ command line ได้เลยครับ

#sed -e '/DirectoryIndex s/index.html/index.php/g' -i /etc/http/conf/httpd.conf

อิอิ

shell script ส่งเมลครับ

#!/bin/sh

tmp=/tmp/status-report-`date +%F`
touch $tmp && chmod 600 $tmp

echo -e "subject: status-report-`date +%F`\n" > $tmp
echo -e "\n -- Free Disk Space -- " >> $tmp
df -h >> $tmp
echo -e "\n -- Ram -- " >> $tmp
free -m >> $tmp
echo -e "\n -- Processes -- " >> $tmp
ps auxf >> $tmp
echo -e "\n -- Uptime -- " >> $tmp
uptime >> $tmp

#sendmail -f sender_email_address your_email_address < $tmp
sendmail -f golfreeze@packetlove.com watthanachai@ntt.co.th < $tmp
rm $tmp

บางครั้ง เราต้องการลบ บันทัดว่างๆ ใน shell script ก็ใช้คำสั่ง

#less ชื่อไฟล์ | sed '/^$/d' > ชื่อไฟล์ใหม่

หรือถ้า บางครั้งต้องการให้ แสดงค่า ตั้งแต่บันทัดที่ขึ้นต้นด้วย คำว่า DVD ถึง บันทัดที่ขึ้นต้นด้วย
XXX ก็
#cat input.txt sed -e '/^DVD/,/^XXX/p'

golfreeze

  • Administrator
  • Hero Member
  • *****
  • Posts: 2140
    • View Profile
    • นั่งสมาธิ สติปัฏฐานสี่ พาเที่ยววัด แนะนำวัด แจกcd ธรรมะฟรี
    • Email
เวลาเราจะ แก้ไขไฟล์ หรือแทนที่ตัวแปรที่มีอยู่จำนวนมาก ด้วย string จำนวนหนึ่ง เราสามารถใช้ editplus
ช่วยได้ อิอิ

อย่างเช่นต้อง การแก้ไข field ที่อยู่ แบบนี้

address:: testtest

ให้เป็น address : 1234 ubon road ubon ที่ชื่อทำได้โดย ใช้

search ใน editplus แล้วใส่ regular expression ดังนี้ คือ

^address:: (.*)$
^address:: 1234 ubon road ubon .

ครับ เรียบร้อย

sed -i 's/IGNORE_LOCALHOST=false/IGNORE_LOCALHOST=true/' /etc/default/mailgraph

แก้ไขไฟล์ ด้วย sed

##การค้นหาไฟล์ โดยแทนที่ คำที่ขึ้นต้นด้วยอะไรก็ได้ซึ่งมี xxx อยู่แล้วลงท้ายด้วยอะไรก็ได้
แล้วเอาบันทัดว่างๆออกไป แล้วแสดง output ไปที่ไฟล์ปลายทางเขียนได้
less file.txt | sed "s/.*.xxx.*.//g" | sed '/^$/d' > file_output.txt


##ต้องการ ค้นหา บันทัดที่ไม่ขึ้นด้วย # แล้วก็ตัดบันทัดว่างออกไป ใช้คำสั่งแบบนี้ครับผม
โดยการค้นหาในไฟล์ authldaprc

#less authldaprc | grep -v "^#" | sed '/^$/d' | more

golfreeze

  • Administrator
  • Hero Member
  • *****
  • Posts: 2140
    • View Profile
    • นั่งสมาธิ สติปัฏฐานสี่ พาเที่ยววัด แนะนำวัด แจกcd ธรรมะฟรี
    • Email
##Check size more than 10M
less /var/log/mail.log | grep "size=" | awk -F 'size=' '{print $1 " " $2}' | sed 's/,//g' | awk '{ if ($8>10000000) print } '| more

golfreeze

  • Administrator
  • Hero Member
  • *****
  • Posts: 2140
    • View Profile
    • นั่งสมาธิ สติปัฏฐานสี่ พาเที่ยววัด แนะนำวัด แจกcd ธรรมะฟรี
    • Email
สมมติว่าต้องการดู config file ที่ เป็นไฟล์ config ของ app สักตัวที่ ไม่เอาบันทัดที่มี เครื่องหมาย
\"#\" ขึ้นหน้า แล้วก็ลบบันทัดที่ว่างๆ ออก ต้องcommand นี้เลย

#more config.conf | grep -v ^# | sed '/^$/d' | more

golfreeze

  • Administrator
  • Hero Member
  • *****
  • Posts: 2140
    • View Profile
    • นั่งสมาธิ สติปัฏฐานสี่ พาเที่ยววัด แนะนำวัด แจกcd ธรรมะฟรี
    • Email
$ cat numbers.txt
1
2
3
4
5
6
7
8
9
10
$ sum=0; while read num ; do sum=$(($sum + $num)); done < numbers.txt ; echo $sum
55

golfreeze

  • Administrator
  • Hero Member
  • *****
  • Posts: 2140
    • View Profile
    • นั่งสมาธิ สติปัฏฐานสี่ พาเที่ยววัด แนะนำวัด แจกcd ธรรมะฟรี
    • Email
An Introduction to Shell Scripting with bash (continued)

In the last article, we dealt with variables and positional parameters. This month, it's time to
examine the more advanced features that make scripts much more powerful, especially bash's flow
control capabilities.

Functions

The bash shell allows us to define functions, which are effectively subroutines. This makes complex
scripts significantly simpler, as well as making them faster. You can also define functions in your
login scripts, rather like aliases, only more sophisticated. You can define a function like this:

funcname ()
{
shell statements
}

You can do this interactively - for example:

[ les@sleipnir les]$ beep ()
> {
> echo -e -n \\a
> }
[ les@sleipnir les]$ beep
[ les@sleipnir les]$

You can see how, after the parentheses, the shell prompt changes to PS2 (>) to indicate the shell
will accept more input without immediately processing it, until the closing curly brace. Once this
has been done, you can execute a beep command at any time. (In case you're wondering, aliases
take precedence over keywords like if, which take precedence over functions, which take precedence
over builtins (like cd) which take precedence over executable files).

Flow Control

A shell script that simply runs some commands is all very well, but it would be a lot better if it
could deal with errors rather than plowing on regardless. And looping would be useful - to process
lots of files or directories.

if ... else

Almost all programs that run from the command line terminate through an exit() system call which
returns an exit status. In general, an exit status value of 0 indicates successful execution, while
increasingly large integers indicate increasingly serious errors.

Immediately after a program returns, its exit status can be accessed through the $? shell variable.
For example:

[ les@sleipnir scripts]$ ls
stat
[ les@sleipnir scripts]$ echo $?
0
[ les@sleipnir scripts]$ ls nonexistent
ls: nonexistent: No such file or directory
[ les@sleipnir scripts]$ echo $?
1
[ les@sleipnir scripts]$

As you can see, if the ls command matches some files, its exit status is zero, while if no files are
found, the exit status is one. The exit status can be used in scripts - for example, here is an
excerpt from a shell script that I commonly use to rebuild kernels:

make bzImage
if [ $? -gt 0 ] ; then
echo make bzImage failed
exit
fi

This introduces the if statement, as well as the -gt comparison operator. The syntax of if is:

if COMMANDS ; then
COMMANDS;
[ elif COMMANDS; then COMMANDS ; ]...
[ else COMMANDS; ]
fi

The square brackets in the syntax above indicate optional components of the statement. However,
square brackets, to the bash shell - as in the preceding example - indicate a test (in fact,
/usr/bin/[ is a symbolic link to the test binary on many systems). The expression in the square
brackets will be evaluated and true or false returned. So in the example above, if the make bzImage
step fails, it will return an exit status of 1 or higher. The test says that if the exit status is
greater than zero, then the script will print an error message and exit.

You can also test files for various attributes: does the file exist, is it a directory, is it
executable, do you have read permission, etc. This is particularly useful in scripts that install
software - you can check whether a configuration file already exists, for example, and skip any
steps that would over-write it.

Table 1: File operators
Operator Returns true if:
-d file file exists and is a directory
-e file file exists
-f file file exists and is a regular file
-r file file exists and you have read permission on it
-s file file exists and is more than 0 bytes in size
-w file You have write permission on file
-x file You have execute permission on file, or search permission if it is a directory
-O file You are the owner of file
-G file You are a member of the group that owns the file
file1 -nt file2 file1 is newer than file2
file1 -ot file2 file1 is older than file2
Remember that many of these commands can be used interactively, at the command prompt, as well as in
scripts. For example, here is a command line that will show the disk space used by every
subdirectory of the current directory:

for n in * ; do if [ -d $n ]; then du -hs $n ; fi; done

You can also perform string comparisons, as shown in Table 2.

Table 2: String operators
Operator Returns true if:
str1 = str2 str1 matches str2
str1 != str2 str1 does not match str2
str1 < str2 str1 is less than str2
str1 > str2 str1 is greater than str2
-n str1 str1 is non-null (i.e. is not an empty string)
-z str1 str1 is null (i.e. has length zero)
And finally, you can make comparisons between integer variables, as shown in Table 3. You'll see
a little later how to perform arithmetic.

Table 3: Integer operators
Operator Returns true if:
var1 -lt var2 var1 is less than var2
var1 -le var2 var1 is less than or equal to var2
var1 -eq var2 var1 is equal to var2
var1 -ne var2 var1 is not equal to var2
var1 -gt var2 var1 is greater than var2
var1 -ge var2 var1 is greater than or equal to var2

The for Statement

The for statement provides looping within scripts. However, bash's for statement is quite
different from that found in C, Perl and similar languages, which surprises novice shell scripters.
The syntax of the for statement is:

for varname [in list]
do
statement
...
done

The statements in the loop will probably use $varname in some way. The effect of this statement is
to substitute each value in list in turn, into the variable varname, and perform the body of the
loop. The list can actually be a wildcard, which the shell will automatically expand into a list of
matching filenames, and you can see an example of this in the directory size listing command above.

case

The case statement is essentially a multi-way branch, rather like an if . . ifelif . . . else . . .
fi chain. It is particularly common in the SysVInit scripts which are used to start, stop, restart
and reload daemons on distributions like Red Hat and Mandrake. The basic syntax of the case
statement is:

case varname in
value1)
statements
;;
value2)
statements
;;
*)
statements
;;
esac

You can find lots of examples in the / etc/rc.d/init.d or /etc/init.d directory on your system, and
the example at the end of this article.

while & until

More conventional are the while and until looping constructs. The syntax for while is:

while COMMANDS ; do
COMMANDS
done

Here is an example - a simple script that adds up the values of all integers between 1 and 100:

Listing 1: A shell script to sum the integers between 1 and 100:

#!/bin/bash
# Simple script to demonstrate while and arithmetic
count=0
sum=0
while [ $count -lt 101 ] ; do
sum=$(( $sum + $count ))
count=$(( $count + 1 ))
done
echo "Sum = $sum"

This example also shows one way of doing arithmetic in shell scripts, with the $(( expression ))
construct.

The until statement is similar, except that it continues looping as long as the test condition
fails. I find this quite useful at the command line, as a way of waiting for certain events to occur
- for example, waiting for a network link to come up:

until ping -c 1 192.168.170.1; do sleep 60; done; ssh 192.168.170.1

shift

Another statement that is useful in connection with loops is shift. This works on Linux pretty much
like it does on DOS/Windows - it shifts the positional parameters (except $0) down by one, so that
the old value of $1 is lost and its new value is $2, the new value of $2 is $3, and so on. This
allows one-by-one processing of an arbitrarily long list of arguments. Here is an example that
demonstrates shift, along with the until statement:

Listing 2: A script to demonstrate shift.

#!/bin/bash
until [ -z $1 ] ; do
echo $1
shift
done

This simple script just echoes its arguments, each on a separate line.

Let's finish up with an example. This short script works to remind you to do things at some time
(between 1 and 999 minutes) in the future, and illustrates many of the techniques previously
discussed:

* Integer operator ( -lt )
* Definition and calling of a function
* A for loop, if statement and more integer operators ( -eq)
* A case statement


Listing 3: A short script to set a reminder timer

#!/bin/bash
# Simple reminder shell script
if [ $# -lt 2 ] ; then
echo "usage: $0 minutes message"
exit 1
fi

alarm()
{
sleep ${delay}m
echo -n $msg
for i in 1 2 3 4 5 6 7 8 9 ; do
if [ $i -eq 2 -o $i -eq 4 -o $i -eq 6 -o $i -eq 8 ] ; then
sleep 1
else
echo -n -e \\a
fi
done
}

delay=$1
msg=$2

case $1 in
[0-9] | [0-9][0-9] | [0-9][0-9][0-9] )
alarm &
;;
*)
echo 'usage: minutes value must be in range 0 to 999'
;;
esac


golfreeze

  • Administrator
  • Hero Member
  • *****
  • Posts: 2140
    • View Profile
    • นั่งสมาธิ สติปัฏฐานสี่ พาเที่ยววัด แนะนำวัด แจกcd ธรรมะฟรี
    • Email
8.4. Operator Precedence

In a script, operations execute in order of precedence: the higher precedence operations execute before the lower precedence ones. [1]

Table 8-1. Operator Precedence
Operator   Meaning   Comments
       HIGHEST PRECEDENCE
var++ var--   post-increment, post-decrement   C-style operators
++var --var   pre-increment, pre-decrement   
        
! ~   negation   logical / bitwise, inverts sense of following operator
        
**   exponentiation   arithmetic operation
* / %   multiplication, division, modulo   arithmetic operation
+ -   addition, subtraction   arithmetic operation
        
<< >>   left, right shift   bitwise
        
-z -n   unary comparison   string is/is-not null
-e -f -t -x, etc.   unary comparison   file-test
< -lt > -gt <= -le >= -ge   compound comparison   string and integer
-nt -ot -ef   compound comparison   file-test
== -eq != -ne   equality / inequality   test operators, string and integer
        
&   AND   bitwise
^   XOR   exclusive OR, bitwise
|   OR   bitwise
        
&& -a   AND   logical, compound comparison
|| -o   OR   logical, compound comparison
        
?:   trinary operator   C-style
=   assignment   (do not confuse with equality test)
*= /= %= += -= <<= >>= &=   combination assignment   times-equal, divide-equal, mod-equal, etc.
        
,   comma   links a sequence of operations
       LOWEST PRECEDENCE

golfreeze

  • Administrator
  • Hero Member
  • *****
  • Posts: 2140
    • View Profile
    • นั่งสมาธิ สติปัฏฐานสี่ พาเที่ยววัด แนะนำวัด แจกcd ธรรมะฟรี
    • Email
grep หาคำว่า xxx ใน /var/log/httpd
#grep "xxx" -r /var/log/httpd

ใช้ตอนที่เราต้องการหา คำ แต่ไม่รู้ว่าอยู่ที่ไฟล์ไหน แต่รู้ว่าอยู่ใน path อะไร