"\[2016-12-27 10:01:59\]" > Re.log #同上例, multiple match a Time field in [y-m-d h:i:s] Format (the Xargs command should immediately follow the pipe operator. Use standard input as the primary source data stream. )Other:Find. -iregex ". *\ (\.py\|\.sh\) $" #-iregex ignores the case of the regular expression here is the case of ignoring the suffixFind. -maxdepth 2-type f-print #遍历的最大深度距离此目录最多为2层子目录, list all common FilesFind. -mindepth 2-type F-print #遍历的深度距离当前目录至少两个子目录, listing all filesFind/da
search target starting path, default to the current directory;Find criteria: The specified lookup criteria can be based on file name, size, type, affiliation, permissions, and so on, the default is to find all the files under the specified path;Handling actions: Actions that are made on files that match the search criteria, such as deletions, which are output to standard output by default;Command options
-amin
-atime
-cmin
-ctime
-depth: Start searching from the deepest subdirectory
required, such as the following two methods will cause "find:missing argument to '-exec '", in which the first command error is due to the fact that ";", while the second command error is due to run the statement in the Shell ";" It is thought to be a terminator, not a-exec, so it must be escaped when used.[[emailprotected" standard]# find-name ' *.c '-exec Grep-hna ' Is_array ' {} find:missing argument to '-exec ' [[emailprotected" standard]# find. -name ' *.c '-exec grep-hna ' Is_array ' {}
Findcan explain:Locate the file or directory. Syntax:Find [Directory ...] [-amin [-mtime Additional notes:the Find directive is used to find files that match the criteria. Any string that precedes the parameter will be treated as the directory you want to find. Parameters:-amin-anewer-atime-cmin-cnewer-ctime-daystart The time from this day onwards. -depth starts from the deepest subdirectory of the specified directory. -expty look for files with a file size of 0 byte, or empty directories withou
httpd.conf file information. 12063 34-rw-r--r--1 root root 33545 Dec 15:36/etc/httpd/conf/httpd.confThe following table is a list of commonly used find files and displays the parameters and usage of file informationOptionsDescription of Use-exec command;Find and Execute commands-fprint filePrint file full filename-fprint0 filePrint files full file name including empty files-fprintf file formatPrint file format-OK command;perform actions on user comma
(CLIENTNAME.SIN_ADDR));}
/** Server Application specific code* goes here, e.g. perform some* Action, respond to client etc.*/Write (slavesocket, message,strlen (message));/* You can also use the ANSI function Fprint with caching,* Refresh cache with Fflush as long as you remember if necessary*/Close (Slavesocket);Exit (0);
Default:/* Parent Process * *Close (slavesocket);/* It's a very good habit.* The parent process closes the child process's set in
found.
12063 34-rw-r--r--1 root 33545 Dec 15:36/etc/httpd/conf/httpd.conf
The following table is a list of commonly used to find files and display file information parameters and how to use
Options
Use description
-exec command;
Find and Execute commands
-fprint file
Print file full filename
-fprint0 file
Print the full file name including the empty file
-fprintf file format
Print file format
-OK command;
Perform actions on user commands, confirm in
));}
/** Server Application specific code* goes here, e.g. perform some* Action, respond to client etc.*/Write (slavesocket, message,strlen (message));/* You can also use the ANSI function Fprint with caching,* Refresh cache with Fflush as long as you remember if necessary*/Close (Slavesocket);Exit (0);
Default:/* Parent Process * *Close (slavesocket);/* It's a very good habit.* The parent process closes the child process's set interface descriptor* J
) $CD/$find etc Home Apps-depth-print | Cpio-ivcdc65536-o/dev/rmt0 $find/etc-name "passwd*"-exec grep "Cnscn" {}; #看是否存在cnscn用户 $find. -name "yao*" | Xargs file $find. -name "yao*" | Xargs echo "" gt;/tmp/core.log $find. -name "yao*" | Xargs chmod o-w find-name april* The current directory to find files starting with April Find-name april* file is found in the current directory with Fprint start file, and output the results to file Find-name ap*-o-n
to standard I/O streams. If you need more control over the output, and print does not meet your requirements, they are what you need. You can also replace them by redirecting output and input to other devices or handling them in a non-standard way. Examples are as follows:ImportSYSif __name__=='__main__': Print('####################') Sys.stdout.write ('Hello Huangdongju') Print('Hello World') name= Raw_input ('Please input your name:') Print('Hello'+name) address=Sys.stdin.readline ()
() #split用法及返回值需加强 # print(goods) res = float(goods[1])*float(goods[-1]) total.append(res)print(total)print(sum(total))#第二种声明式编程写法f=open(‘b.txt‘,‘r‘,encoding=‘utf-8‘) #不能用with 否则会IO操作报错total=(float(line.split()[1])*float(line.split()[-1]) for line in f)print(total)print(sum(total))
The contents of the file are nested in the list in a dictionary form
#[{‘name‘: ‘袜子‘, ‘price‘: ‘100‘, ‘num‘: ‘3‘}, {‘name‘: ‘袜子‘, ‘price‘: ‘100‘, ‘num‘: ‘3‘}, {‘name‘: ‘袜子‘, ‘p
fact, as long as an object has the Write method, it can be used as a "board", tell Sys.stdout where to write.Speaking of the Write method, the first thing you might think of is file manipulation.F=open ('log.txt','w')To declare a file object F as above, this file object has the Write method, which can be used as the standard output and categorization malleability the error output of the board.F=open ('log.txt','w')__console__ = Sys.stdout # make a backup of the default "board"-command line s
highlighted above, when attempting to invoke Sys.stdout.write (), it is found that there is no write methodIn addition, the reason why attribute error is not found here is because Python treats the object/class's function pointer record as a property of the object/class, but retains the entry address of the function.In this case, we must implement a write method for the redirected object:Import SysClass __redirection__:def __init__ (self):Self.buff= "Self.__console__=sys.stdoutDef write (self,
Code code as follows:
Package Main
Import (
"FMT"
"Log"
"NET"
"Net/http"
"Net/http/fcgi"
"OS"
"Os/signal"
"Syscall"
)
VAR (
abort bool
)
Const (
Sock = "/tmp/go.sock"
)
Type Server struct {
}
Func (S Server) servehttp (w http. Responsewriter, R *http. Request) {
Body: = "Hello world\n"
Try to keep the same amount of headers
W.header (). Set ("Server", "GOPHR")
W.header (). Set ("Connection", "keep-alive")
W.header (). Set ("Content-type", "Text/plain")
W.
The example in this article describes how the go language implements a simple Web server. Share to everyone for your reference. The specific analysis is as follows:
Package HTTP is implemented by any HTTP. Handler value to respond to HTTP requests:Package HTTPType Handler Interface {Servehttp (W Responsewriter,R *request)}
In this example, the type Hello implements HTTP. Handler.Note: This example cannot be run on the web-based Guide user interface. In order to attempt to write a Web server, y
"non" relationship in the Find command to look up files if we want to find all of them in the/tmp directory
Files that are not part of the panda, using a simple
Find/tmp! -user Panda
The order will be resolved. Very simple.
Ways to find and display files
Finding a file is our purpose and we would like to know the details and attributes of the file found, if
We take the now find file, in using the LS command to view file information is quite cumbersome, now we can also
Use the two command
#使查找在进入子目录前先行查找完本目录
-fstype #查位于某一类型文件系统中的文件, these file system types can usually be found in/etc/fstab
-mount #查文件时不跨越文件系统mount点
-follow #如果遇到符号链接文件, track the file that the link refers to
-cpio%; #查位于某一类型文件系统中的文件, these file system types can usually be found in/etc/fstab
-mount #查文件时不跨越文件系统mount点
-follow #如果遇到符号链接文件, track the file that the link refers to
-cpio #对匹配的文件使用cpio命令, back them up to tape devices
-prune #忽略某个目录
Example:
Find-name april* Find files starting w
65:240 active undef running| '-1:0:1:6 sdag 66:0 active undef running'-+-policy= ' round-robin 0 ' prio=0 status=enabled|-1:0:3:6 sdba 67:64 active undef running|-1:0:2:6 Sdar 66:176 active undef running|-3:0:2:6 SDBJ 67:208 active undef running'-3:0:3:6 Sdbs 68:96 active undef running You can see the Data5 normal state that you just added --Edit Udev[Email protected] rules.d]# pwd/etc/udev/rules.d[Email protected] rules.d]# ls-a. 60-pcmcia.rules 90-hal.rules 99-fuse.rules.. 60-raw.rules 97-blu
grep ' cnscn ' {} \; #看是否存在cnscn用户#small2: This has to have root access.$find. -name ' yao* ' | Xargs file$find. -name ' yao* ' | Xargs echo ' >/tmp/core.log$find. -name ' yao* ' | Xargs chmod o-w======================================================Find-name april* Find files starting with April in the current directoryFind-name april* Fprint file finds files starting with April in the current directory and outputs the resultsFind-name ap*-o-name ma
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.