Come back tonight, write the fourth question, just want to match IP, that regular expression is too disgusting ...
I remember writing before ... But, forget where to put ....
The author of the script test files are thrown into a directory, because the practice is too large, so a directory, all the time named directory, and each directory file name is test1.sh,test2.sh....test10.sh .... At least hundreds of of them ....
And the author wants, is one day, writes a script, the author only remembers that script inside looks like uses the ping keyword ... So the demand came out:
The code is as follows:
#!/bin/bash
#Author: MOS
#Script name:keyfind
#Date & time:2012-10-09/23:56:59
#Version: 1.0.1
#Description:
#
#找打笔者脚本目录的位置下, all the general files are thrown into the array
array= (' find/root/shellscripts/-type f ')
# Loop through each file, use grep to filter keywords ("positional parameters"), and when filtered, print out the name for
I in ${array[*]};d o
grep $i &>/dev/null & & echo "$i" done
This article from the "Self-Improvement" blog, please be sure to retain this source http://mos1989.blog.51cto.com/4226977/1020067