grep -v 反向查找
1.grep 是查找含有指定文本行的意思,比如grep 'test' 就是查找含有test的文本的行2.grep -v 是反向查找的意思,比如 grep -v "grep" 就是查找不含有 grep 字段的行; grep -v ^# /etc/profile就是不显示以#开头的行例如 ps -ef | grep '/home/helife/tomcat-wap/' | grep -v "grep"
1.grep 是查找含有指定文本行的意思,比如grep 'test' 就是查找含有test的文本的行
2.grep -v 是反向查找的意思,比如 grep -v "grep" 就是查找不含有 grep 字段的行; grep -v ^# /etc/profile就是不显示以#开头的行
例如 ps -ef | grep '/home/helife/tomcat-wap/' | grep -v "grep"
查看包含 '/home/helife/tomcat-wap/' 但不包含 "grep" 的进程
过滤空白行
grep -v '^$' abc.txt
不显示以#开头的行
grep -v '^#' abc.txt
[root@neo ~]# more anaconda-ks.cfg |grep -v ^#
auth --enableshadow --passalgo=sha512
cdrom
graphical
firstboot --enable
ignoredisk --only-use=sda
keyboard --vckeymap=us --xlayouts='us'
lang en_US.UTF-8
network --bootproto=dhcp --device=ens33 --onboot=off --ipv6=auto --no-activate
network --hostname=neo
rootpw --iscrypted $6$1ifz6Lz7c4cqL3BY$NEVrZ4yqCf5wkcbst6Q2HKg94wrb7QUE72UjASES804AaExREOqOhJ4HV77g87OBa7y2gsioLF1N4O3JwhXl81
services --disabled="chronyd"
timezone Asia/Shanghai --isUtc --nontp
user --groups=wheel --name=neo --password=$6$OJeQNwrpNJRb2GNx$Ze5Bs8wVv/GgGNhvQRjMmNynwAEm0J4ba0aukkNm8WCO5C2xngFnbOrtu7tTNltRAbNsJykneYuOQ.5xXQUze. --iscrypted --gecos="neo"
bootloader --append=" crashkernel=auto" --location=mbr --boot-drive=sda
clearpart --none --initlabel
part pv.252 --fstype="lvmpv" --ondisk=sda --size=101399
part /boot --fstype="xfs" --ondisk=sda --size=1000
volgroup centos --pesize=4096 pv.252
logvol / --fstype="xfs" --size=95395 --name=root --vgname=centos
logvol swap --fstype="swap" --size=6000 --name=swap --vgname=centos
%packages
@^minimal
@core
kexec-tools
%end
%addon com_redhat_kdump --enable --reserve-mb='auto'
%end
%anaconda
pwpolicy root --minlen=6 --minquality=1 --notstrict --nochanges --notempty
pwpolicy user --minlen=6 --minquality=1 --notstrict --nochanges --emptyok
pwpolicy luks --minlen=6 --minquality=1 --notstrict --nochanges --notempty
%end
[root@neo ~]# more anaconda-ks.cfg |grep -v '^$'
#version=DEVEL
# System authorization information
auth --enableshadow --passalgo=sha512
# Use CDROM installation media
cdrom
# Use graphical install
graphical
# Run the Setup Agent on first boot
firstboot --enable
ignoredisk --only-use=sda
# Keyboard layouts
keyboard --vckeymap=us --xlayouts='us'
# System language
lang en_US.UTF-8
# Network information
network --bootproto=dhcp --device=ens33 --onboot=off --ipv6=auto --no-activate
network --hostname=neo
# Root password
rootpw --iscrypted $6$1ifz6Lz7c4cqL3BY$NEVrZ4yqCf5wkcbst6Q2HKg94wrb7QUE72UjASES804AaExREOqOhJ4HV77g87OBa7y2gsioLF1N4O3JwhXl81
# System services
services --disabled="chronyd"
# System timezone
timezone Asia/Shanghai --isUtc --nontp
user --groups=wheel --name=neo --password=$6$OJeQNwrpNJRb2GNx$Ze5Bs8wVv/GgGNhvQRjMmNynwAEm0J4ba0aukkNm8WCO5C2xngFnbOrtu7tTNltRAbNsJykneYuOQ.5xXQUze. --iscrypted --gecos="neo"
# System bootloader configuration
bootloader --append=" crashkernel=auto" --location=mbr --boot-drive=sda
# Partition clearing information
clearpart --none --initlabel
# Disk partitioning information
part pv.252 --fstype="lvmpv" --ondisk=sda --size=101399
part /boot --fstype="xfs" --ondisk=sda --size=1000
volgroup centos --pesize=4096 pv.252
logvol / --fstype="xfs" --size=95395 --name=root --vgname=centos
logvol swap --fstype="swap" --size=6000 --name=swap --vgname=centos
%packages
@^minimal
@core
kexec-tools
%end
%addon com_redhat_kdump --enable --reserve-mb='auto'
%end
%anaconda
pwpolicy root --minlen=6 --minquality=1 --notstrict --nochanges --notempty
pwpolicy user --minlen=6 --minquality=1 --notstrict --nochanges --emptyok
pwpolicy luks --minlen=6 --minquality=1 --notstrict --nochanges --notempty
%end
更多推荐
所有评论(0)