当前位置:网站首页>Job regular sed
Job regular sed
2022-07-21 19:41:00 【MZdzt】
1、 Show /etc/rc.d/rc.sysinit File with size insensitive h Beginning line ;
[[email protected] shell]# grep '^[hH]' /etc/passwd
2、 Show /etc/passwd China and Israel sh The line at the end
[[email protected] shell]# grep 'sh$' /etc/passwd
3、 Show /etc/fstab China and Israel # start , One or more whitespace characters followed by , And then it's followed by any non whitespace line ;
grep '^\#[[:space:]]\{1,\}.\{1,\}' /etc/fastab
4. lookup /etc/rc.d/rc.local Contained in the “ With to Start with to ending ” Word serial of
grep -Ew "(to).*\1" /etc/rc.d/rc.local
5. lookup /etc/inittab contains “ With s start , And d Ending words ” Pattern line
grep -w '\<s[a-z]*d\>' /etc/inittab
6. lookup ifconfig In the command result 1-255 Integer between
ifconfig | grep -oE "<\[0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5]\>"
7、 Show /var/log/secure The file contains “Failed” or “FAILED” The line of ;
grep -w 'Failed|FAILED' /var/log/secure
8、 stay /etc/passwd Take out the default shell by bash The line of
grep "bash" /etc/passwd
9、 List... In long format /etc/ Directory to ns start 、.conf File information at the end
10、 Highlight passwd Colon in file , And the characters on both sides ;
grep --color ".:." /etc/passwd
8
1、 Delete /etc/grub2.conf All the white space characters at the beginning of the line that start with white space in the file
sed 's/^[[:space:]]//' /etc/grub2.cfg
2、 Delete /etc/fstab All # start , The first line of a line followed by at least one white space character # And white space characters
sed 's/^#[[:space:]]*//' /etc/fstab
3、 stay /root/install.log Add... At the beginning of each line # Number
sed 's/^.*$/#&/' /root/install.log
4、 stay /etc/fstab The document does not contain # The beginning of the first line increases # Number
sed 's/^[^#]/#&/' /etc/fstab
5、 utilize sed Take out ifconfig In the command IPv4 Address
ifconfig |sed -n '2p' | sed -r "s/.*inet[[:space:]]*//" | sed -r "s/[[:space:]]*netmask.*//"
6、 Turn off the machine SELinux The function of
sed -i 's/SELINUX=enforcing/SELINUX=disabled/g' /etc/selinux/config
7、 stay /etc/hosts Add content to the configuration file
sed -i '$a bye' test # In the file test1 Enter directly in the last line of "bye"
sed -i '1i\a' test # In the file test1 Insert a line before the first line in "aaa"
边栏推荐
- 无线定位技术实验三 基于信号强度的位置指纹定位仿真
- 读书笔记:《次第花开》
- Audience analysis and uninstall analysis have been comprehensively upgraded, and HMS core analysis service version 6.6.0 has been updated
- Other regular validation rules web launch app
- 无线定位技术实验二 TDOA最小二乘定位法
- Differences among cookies, sessions, and tokens
- 【transformer】ViT
- Part I - Fundamentals of C language_ 7. Pointer
- TikTok怎么开启社交电商?
- 动作活体检测能力,构建安全可靠的支付级“刷脸”体验
猜你喜欢
Poste technique | a40i les trois problèmes de logiciel de carte réseau les plus courants, analysez - les un par un pour vous
信号处理系统综合设计-最小阶数的IIR数字高通滤波器
技術帖 | A40i最常見的3種網卡軟件問題,為你逐一分析
笔试强训第19天
Deep learning - (5) class of data imbalance_ weight
JWT (JSON web token) authentication: the most popular cross domain authentication solution at present
342个中、英文等NLP开源数据集分享
Web3流量聚合平台Starfish OS,给玩家元宇宙新范式体验
蚓激酶白蛋白纳米粒/红细胞膜定向包裹血红蛋白-白蛋白纳米粒的研究制备
Preparation of hemoglobin albumin nanoparticles encapsulated by Lumbrokinase albumin nanoparticles / erythrocyte membrane
随机推荐
MySQL optimization summary I
Deep learning - (5) class of data imbalance_ weight
The blue light and green light go out on time, and program the secret language of guru
Day009 circular structure (exercise)
(1)达梦数据库模型分析
Introduction to ESP privilege isolation mechanism
Other regular validation rules web launch app
armv8 DVFS
sort内部实现原理
Trivy source code analysis (scanning the vulnerability information in the image)
测试入门——使用场景法设计ATM的测试用例
onmousemove=alert(1) style='width
除去不必要的字段
Common function test checkpoints and use case design ideas
C language file operation
TikTok怎么开启社交电商?
22张图带你深入剖析前缀、中缀、后缀表达式以及表达式求值
MySQL (2)
[cloud native] what if SQL (and stored procedures) runs too slowly?
2022 the hottest free Chinese version of the whole network - free sharing of "Application Tutorial of deep learning in image processing"