首页
题库
公司真题
专项练习
面试题库
在线编程
面试
面试经验
AI 模拟面试
简历
求职
学习
基础学习课
实战项目课
求职辅导课
专栏&文章
竞赛
我要招人
发布职位
发布职位、邀约牛人
更多企业解决方案
AI面试、笔试、校招、雇品
HR免费试用AI面试
最新面试提效必备
登录
/
注册
已注销
获赞
14
粉丝
0
关注
0
看过 TA
27
IP属地:北京
暂未填写个人简介
私信
关注
拉黑
举报
举报
确定要拉黑已注销吗?
发布(31)
评论
刷题
收藏
已注销
关注TA,不错过内容更新
关注
2023-08-25 21:46
题解 | #域名进行计数排序处理#
#!/bin/bash awk -F"/" '{print $3}' ./nowcoder.txt |sort |uniq -c| awk '{print $1" "$2}'|sort -r
0
点赞
评论
收藏
分享
2023-08-25 21:34
题解 | #将字段逆序输出文件的每行#
#!/bin/bash awk -F":" '{ for ( i = NF; i > 0; i-- ){ if ( i > 1 ) printf "%s:", $i else printf "%s\n", $i } }' ./nowcoder.txt
0
点赞
评论
收藏
分享
2023-08-24 22:33
题解 | #判断输入的是否为IP地址#
#!/bin/bash awk -F"." '{ if ( NF == 4 ) { #判断是否4段 for (i = 1; i < 5; i++){ if ($i > 255 || $i < 0){ #判断是否在0~255之间 print("no") break #只要其中一个不在,退出当前循环 } } if (i == 5) print("yes") #i=5说明4段全部遍历成功在0~255之间 }else { print("error") } }' ./nowcoder.txt
0
点赞
评论
收藏
分享
2023-08-21 22:08
题解 | #去掉不需要的单词#
#!/bin/bash #-i 不区分大小写,-v 取反 grep -iv "b"
0
点赞
评论
收藏
分享
2023-08-21 22:06
题解 | #求平均值#
#!/bin/bash awk '{if(NR==1) {len=$1} else sum+=$1} END{printf ("%.3f",sum/len)}'
0
点赞
评论
收藏
分享
2023-08-21 21:48
题解 | #打印每一行出现的数字个数#
#!/bin/bash awk -F '[1,2,3,4,5]' 'BEGIN{sum=0}{ for (i=1;i<=NR;++i){if (i==NR){ print "line"i" number: "NF-1;sum+=NF-1 } } }END{print "sum is "sum}' ./nowcoder.txt -F '[1,2,3,4,5]' 指定分隔符为1,2,3,4,5if (i==NR) 当行号与循环的i对应,即在同一行时执行括号内命令(因为NR是1,2,3,4,不限制会进行多次循环)
0
点赞
评论
收藏
分享
2023-08-21 20:55
题解 | #转置文件的内容#
#!/bin/bash awk '{print $1}' ./nowcoder.txt| tr '\n' ' ' echo awk '{print $2}' ./nowcoder.txt| tr '\n' ' '
0
点赞
评论
收藏
分享
2023-08-21 20:45
题解 | #第二列是否有重复#
#!/bin/bash awk '{print $2}' ./nowcoder.txt|sort|uniq -c|sort|tail -n2
0
点赞
评论
收藏
分享
2023-08-21 20:42
题解 | #统计每个单词出现的个数#
#!/bin/bash cat ./nowcoder.txt|xargs -n1|sort|uniq -c|sort|awk '{print $2,$1}'
0
点赞
评论
收藏
分享
2023-08-20 21:05
题解 | #统计所有进程占用内存百分比的和#
#!/bin/bash awk 'BEGIN{sum=0}{sum+=$4}END{print sum}' ./nowcoder.txt
0
点赞
评论
收藏
分享
2023-08-20 20:55
题解 | #打印字母数小于8的单词#
#!/bin/bash awk '{for(i=1;i<=NF;i++){if(length($i)<8){print $i}}}' ./nowcoder.txt
0
点赞
评论
收藏
分享
2023-08-20 20:04
题解 | #打印空行的行号#
#!/bin/bash awk '/^$/ {print NR}' ./nowcoder.txt /^$/ 代表空行NR 行号
0
点赞
评论
收藏
分享
2023-08-15 21:57
题解 | #Where in 和Not in#
select device_id, gender, age, university, gpa from user_profile where university in ('北京大学', '复旦大学', '山东大学')
0
点赞
评论
收藏
分享
2023-08-15 21:47
题解 | #用where过滤空值练习#
select device_id, gender, age, university from user_profile where age is not NULL
0
点赞
评论
收藏
分享
2023-08-15 21:32
题解 | #查询结果限制返回行数#
select device_id from user_profile order by id limit 2
0
点赞
评论
收藏
分享
1
2
3
创作者周榜
更多
关注他的用户也关注了:
牛客网
牛客网在线编程
牛客网题解
牛客企业服务