[root@m01 ~]# grep ftype ftype=`file -b "$line" | cut -d, -f1` let statarray["$ftype"]++; for ftype in "${!statarray[@]}"; echo $ftype : ${statarray["$ftype"]} 1. 2. 3. 4. 5. 6. 或者 (3)在多个文件中搜索匹配特定模式的文本行: [root@m01 ~]# grep "do" I...
Search for PATTERN in each FILE or standard input. PATTERN is, by default, a basic regular expression (BRE). Example: grep -i 'hello world' menu.h main.c Regexp selection and interpretation: -E, --extended-regexp PATTERN is an extended regular expression (ERE) -F, --fixed-strings PAT...
-H, --with-filename Print the file name for each match. This is the default when there is more than one file to search. -h, --no-filename Suppress the prefixing of file names on output. This is the default when there is only one file (or only standard input) to search. --labe...
When type is binary, grep may treat non-text bytes as line terminators even without the -z option. This means choosing binary versus text can affect whether a pattern matches a file. For example, when type is binary the pattern q$ might match q immediately followed by a null byte, even...
grep -[acinv] '搜索内容串' filename -a 以文本文件方式搜索 -c 计算找到的符合行的次数 -i 忽略大小写 -n 顺便输出行号 -v 反向选择,即找 没有搜索字符串的行 其中搜索串可以是正则表达式! 1 搜索有the的行,并输出行号 $grep -n 'the' regular_express.txt ...
[--iglob <GLOB>...] [--ignore-file <PATH>...] [--type-add <TYPE_SPEC>...] [-t <TYPE>...] [-T <TYPE>...] [--current-buffer | --all-buffers] [--recall] [--append] [--reverse] [--stayOpen] [--input <INPUT> | --cword] ...
addr - $remote_user [$time_local] "$request" ' '$status $body_bytes_sent "$http_referer" ' '"$http_user_agent" "$http_x_forwarded_for"'; access_log /var/log/nginx/access.log main; sendfile on; #tcp_nopush on; keepalive_timeout 65; #gzip on;...
`k' for Kilobytes (units of 1024 bytes) `M' for Megabytes (units of 1048576 bytes) `G' for Gigabytes (units of 1073741824 bytes) -type c : 文件类型是 c 的文件 File is of type c: b block (buffered) special c character (unbuffered) special ...
1grep [option] pattern file 1.2.2 命令功能 用于过滤/搜索的特定字符。可使用正则表达式能多种命令配合使用,使用上十分灵活。 1.2.3 命令参数 常用参数已加粗 -A<显示行数>:除了显示符合范本样式的那一列之外,并显示该行之后的内容。 -B<显示行数>:除了显示符合样式的那一行之外,并显示该行之前的内容。
grep[option] patternfile 1.2.2 命令功能 用于过滤/搜索的特定字符。可使用正则表达式能多种命令配合使用,使用上十分灵活。 1.2.3 命令参数 常用参数已加粗 -A<显示行数>:除了显示符合范本样式的那一列之外,并显示该行之后的内容。 -B<显示行数>:除了显示符合样式的那一行之外,并显示该行之前的内容。