b2科目四模拟试题多少题驾考考爆了怎么补救
b2科目四模拟试题多少题 驾考考爆了怎么补救

shell字符截取命令之awk命令

电脑杂谈  发布时间:2020-02-25 07:00:15  来源:网络整理

shell awk分割字符串_shell awk_awk 调用shell命令

[root@localhost ~]# cut -f 2shell awk分割字符串,4 student.txt

furong 85

fengj 60

cang 70

[root@localhost ~]# awk '{printf $2 "\t" $4 "\n"}' student.txt

furong 85

fengj 60

cang 70

[root@localhost ~]# awk '{print $2 "\t" $4}' student.txt

awk 调用shell命令_shell awk_shell awk分割字符串

furong 85

fengj 60

cang 70

[root@localhost ~]# df -h|awk '{print $1 "\t" $3}'

Filesystem Used

/dev/sda3 124M

devtmpfs 0

tmpfs 84K

tmpfs 7.0M

tmpfs 0

shell awk分割字符串_awk 调用shell命令_shell awk

/dev/sda5 3.9G

/dev/sda7 33M

/dev/sda2 1.3G

/dev/sda1 153M

tmpfs 16K

tmpfs 0

三 在awk命令的输出中支持print和printf命令

[root@localhost ~]# df -h|grep "/dev/sda5" |awk '{print $5}'

[root@localhost ~]# df -h|grep "/dev/sda5" |awk '{print $5}'|cut -d "%" -f 1

shell awk分割字符串_shell awk_awk 调用shell命令

[root@localhost ~]# awk 'BEGIN{printf "This is a transcript \n"}{printf $2 "\t" $4 "\n"}' student.txt

This is a transcript

furong 85

fengj 60

cang 70

[root@localhost ~]# awk 'END{printf "This is a transcript \n"}{printf $2 "\t" $4 "\n"}' student.txt

furong 85

fengj 60

cang 70

This is a transcript

awk 调用shell命令_shell awk分割字符串_shell awk

[root@localhost ~]# cat /etc/passwd | grep "/bin/bash"

root:x:0:0:root:/root:/bin/bash

cakin24:x:1000:1000:cakin24,cakinshell awk分割字符串,cakin,cakin:/home/cakin24:/bin/bash

test:x:1003:1001::/home/xxx:/bin/bash

cls:x:1001:1001:dgdzmx:/home/cls:/bin/bash

[root@localhost ~]# cat /etc/passwd | grep "/bin/bash"|\

> awk 'BEGIN{FS=":"}{printf $1 "\t" $3 "\n"}'

root 0

cakin24 1000

test 1003

cls 1001

[root@localhost ~]# cat student.txt |awk '$4>=70{printf $2 "\n"}'

furong


本文来自电脑杂谈,转载请注明本文网址:
http://www.pc-fly.com/a/jisuanjixue/article-141996-1.html

    相关阅读
      发表评论  请自觉遵守互联网相关的政策法规,严禁发布、暴力、反动的言论

      热点图片
      拼命载入中...