awk's usage
来源:互联网 发布:小米4屏幕裂了失灵淘宝 编辑:程序博客网 时间:2024/05/22 02:27
awk's usage
awk -F "spearator" '[BEGIN {}] [{}] [END {}]' file1 file2 *.txt
example
#---- Sperator -----
00. awk '{print $1}' info.txt
01. awk -F ";" '{print $0}' info.txt
02. awk -F "[,/t]" '{print $2, $3}' info.txt
03. awk -F "[,/t]" '{if( $1 > 100) print $2, $3;}' info.txt
#---- BEGIN and END -----
04. awk -F ",/t" 'BEGIN {num = 0;} {num++;} END { printf "total=%s/n", $num }' info.txt
05. awk -F ",/t" 'BEGIN {num = 0;} {print num++;} ' info.txt
#---- Regular Expressions -----
05. awk '/abc/ { print $1, $3} *.txt
06. awk '/abc/ { printf "find %s/n", $0}
/123/ { printf "find %s/n", $1}' *.txt
07. awk '/abc/ || /123/ { print $1, $3} *.txt
08. awk '/abc/ && /123/ { print $1, $3} *.txt
09. awk -F "[,;]" '/abc/ {print hello,$0} ; /123/ {print world,$0}' xxx.txt
10. awk '{ if ($1 ~ /Jack/) print $0 }' # ~ -> $1 match "Jack"
11. awk '{ if ($1 !~ /Jack/) print $0 }' # !~ -> $1 not match "Jack"
#---- Build Variable -----
NF: the last field in a record
RS: character can be used for the record separator
NR: the total number of input records read so far from all data files
FNR: the number of records that have been read so far from the current input file
- awk's usage
- awk usage
- Usage of awk
- awk usage conclude
- awk -F usage
- middlegen's usage
- Escape's usage
- Android SharedPreferences's usage
- SQL: sql's usage
- javascript's call usage
- LIBSVM's usage
- What's NLS_LANG and usage
- Usage of CXQ's Arrangement
- usage
- Windows Installation for sulley and minGW's usage
- netstat -nat | awk '/^tcp/{++S[$NF]}END{for (a in s) print a,S[a]}'详解
- netstat -n | awk '/^tcp/ {++S[$NF]} END {for(a in S) print a, S[a]}' 详解
- zcat %s | awk '{print $8}' | sort -u的含义
- error LNK2001 与 RUNTIME_CLASS 的问题解决
- 消息驱动bean和会话bean的区别
- 医院院长修电视
- C# 局域网聊天室
- 删除SAP数据库表数据的几种方法(转载)
- awk's usage
- Android Logcat 报错:Could not create the view: For input string: ""
- 姐很不容易
- 自定义Android控件
- 使用mkisofs创建可启动Linux
- 悲剧之后 记百度三面
- Unable to load client print control. 无法加载客户端打印控件
- 密码安全验证
- 利用Tree命令生成磁盘文件列表