在指定的檔案過濾想要的內容
透過內容進行過濾
grep 關鍵字 檔名
如下:
[root@source ~]# cat anaconda-ks.cfg
# Kickstart file automatically generated by anaconda.
#version=DEVEL
install
cdrom
lang en_US.UTF-8
keyboard us
network --onboot no --device eth0 --bootproto dhcp --noipv6
rootpw --iscrypted $6$JvEQdLOWpZU1/bvT$sukU9N3tBoZMhCVkNvJSaJ1TEJaSqFOzY6AiD3XoGosQ4QuY0ZHm6g7Vqw7Ena6VO24yLH/eN7yzIbRXk3GsG0
firewall --service=ssh
authconfig --enableshadow --passalgo=sha512
selinux --enforcing
timezone --utc Asia/Shanghai
bootloader --location=mbr --driveorder=sda --append="crashkernel=auto rhgb quiet"
# The following is the partition information you requested
# Note that any partitions you deleted are not expressed
# here so unless you clear all partitions first, this is
# not guaranteed to work
#clearpart --linux --drives=sda
#part /boot --fstype=ext4 --size=500
#part pv.008002 --grow --size=1
#volgroup vg_source --pesize=4096 pv.008002
#logvol / --fstype=ext4 --name=lv_root --vgname=vg_source --grow --size=1024 --maxsize=51200
#logvol swap --name=lv_swap --vgname=vg_source --grow --size=4000 --maxsize=4000
%packages
@additional-devel
@backup-client
@backup-server
@base
@cifs-file-server
@client-mgmt-tools
@compat-libraries
@console-internet
@core
@debugging
@basic-desktop
@desktop-debugging
@desktop-platform
@desktop-platform-devel
@development
@dial-up
@directory-client
@directory-server
@mail-server
@eclipse
@emacs
@storage-client-fcoe
@ftp-server
@fonts
@general-desktop
@graphical-admin-tools
@graphics
@hardware-monitoring
@identity-management-server
@infiniband
@input-methods
@internet-browser
@java-platform
@kde-desktop
@large-systems
@legacy-unix
@legacy-x
@mainframe-access
@system-management-messaging-client
@mysql-client
@mysql
@nfs-file-server
@network-server
@storage-server
@network-file-system-client
@network-tools
@php
@performance
@perl-runtime
@postgresql-client
@postgresql
@print-server
@print-client
@remote-desktop-clients
@ruby-runtime
@system-management-snmp
@scientific
@security-tools
@server-platform
@server-platform-devel
@server-policy
@smart-card
@storage-client-multipath
@system-management
@system-admin-tools
@tex
@technical-writing
@turbogears
@virtualization
@virtualization-client
@virtualization-platform
@virtualization-tools
@web-server
@web-servlet
@system-management-wbem
@x11
@storage-client-iscsi
libXinerama-devel
openmotif-devel
libXmu-devel
xorg-x11-proto-devel
startup-notification-devel
libgnomeui-devel
libbonobo-devel
junit
libXau-devel
libgcrypt-devel
popt-devel
gnome-python2-desktop
libdrm-devel
libXrandr-devel
libxslt-devel
libglade2-devel
gnutls-devel
mtools
pax
python-dmidecode
oddjob
wodim
sgpio
genisoimage
device-mapper-persistent-data
systemtap-client
abrt-gui
qt-mysql
desktop-file-utils
ant
rpmdevtools
jpackage-utils
rpmlint
samba-winbind
certmonger
openldap-clients
pam_krb5
krb5-workstation
ldapjdk
samba
krb5-server
netpbm-progs
ImageMagick
slapi-nis
tcp_wrappers
openmotif
xterm
xorg-x11-xdm
libXmu
libXp
python-saslwrapper
perl-DBD-MySQL
dnsmasq
radvd
ebtables
sg3_utils
perl-DBD-SQLite
perl-Mozilla-LDAP
rdesktop
atlas
compat-openmpi
numpy
compat-openmpi-psm
p11-kit-trust
hmaccalc
crypto-utils
scrub
libvirt-java
mod_auth_kerb
mod_nss
certmonger
perl-CGI
python-memcached
mod_revocator
memcached
%end[root@source ~]# grep mod_nss anaconda-ks.cfg
mod_nss
過濾指定行:
[oracle@source ~]$ cat .bash_profile
# .bash_profile
# Get the aliases and functions
if [ -f ~/.bashrc ]; then
. ~/.bashrc
fi
# User specific environment and startup programs
PATH=$PATH:$HOME/bin
export PATH
export EDITOR=vi
export ORACLE_SID=test
export ORACLE_BASE=/u01/app/oracle
export ORACLE_HOME=$ORACLE_BASE/product/11.2.0/dbhome_1
export LD_LIBRARY_PATH=$ORACLE_HOME/lib
export PATH=$ORACLE_HOME/bin:/bin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/X11R6/bin
umask 022
[oracle@source ~]$ sed -n 1p .bash_profile
# .bash_profile
grep 關鍵字 檔名
如下:
[root@source ~]# cat anaconda-ks.cfg
# Kickstart file automatically generated by anaconda.
#version=DEVEL
install
cdrom
lang en_US.UTF-8
keyboard us
network --onboot no --device eth0 --bootproto dhcp --noipv6
rootpw --iscrypted $6$JvEQdLOWpZU1/bvT$sukU9N3tBoZMhCVkNvJSaJ1TEJaSqFOzY6AiD3XoGosQ4QuY0ZHm6g7Vqw7Ena6VO24yLH/eN7yzIbRXk3GsG0
firewall --service=ssh
authconfig --enableshadow --passalgo=sha512
selinux --enforcing
timezone --utc Asia/Shanghai
bootloader --location=mbr --driveorder=sda --append="crashkernel=auto rhgb quiet"
# The following is the partition information you requested
# Note that any partitions you deleted are not expressed
# here so unless you clear all partitions first, this is
# not guaranteed to work
#clearpart --linux --drives=sda
#part /boot --fstype=ext4 --size=500
#part pv.008002 --grow --size=1
#volgroup vg_source --pesize=4096 pv.008002
#logvol / --fstype=ext4 --name=lv_root --vgname=vg_source --grow --size=1024 --maxsize=51200
#logvol swap --name=lv_swap --vgname=vg_source --grow --size=4000 --maxsize=4000
%packages
@additional-devel
@backup-client
@backup-server
@base
@cifs-file-server
@client-mgmt-tools
@compat-libraries
@console-internet
@core
@debugging
@basic-desktop
@desktop-debugging
@desktop-platform
@desktop-platform-devel
@development
@dial-up
@directory-client
@directory-server
@mail-server
@eclipse
@emacs
@storage-client-fcoe
@ftp-server
@fonts
@general-desktop
@graphical-admin-tools
@graphics
@hardware-monitoring
@identity-management-server
@infiniband
@input-methods
@internet-browser
@java-platform
@kde-desktop
@large-systems
@legacy-unix
@legacy-x
@mainframe-access
@system-management-messaging-client
@mysql-client
@mysql
@nfs-file-server
@network-server
@storage-server
@network-file-system-client
@network-tools
@php
@performance
@perl-runtime
@postgresql-client
@postgresql
@print-server
@print-client
@remote-desktop-clients
@ruby-runtime
@system-management-snmp
@scientific
@security-tools
@server-platform
@server-platform-devel
@server-policy
@smart-card
@storage-client-multipath
@system-management
@system-admin-tools
@tex
@technical-writing
@turbogears
@virtualization
@virtualization-client
@virtualization-platform
@virtualization-tools
@web-server
@web-servlet
@system-management-wbem
@x11
@storage-client-iscsi
libXinerama-devel
openmotif-devel
libXmu-devel
xorg-x11-proto-devel
startup-notification-devel
libgnomeui-devel
libbonobo-devel
junit
libXau-devel
libgcrypt-devel
popt-devel
gnome-python2-desktop
libdrm-devel
libXrandr-devel
libxslt-devel
libglade2-devel
gnutls-devel
mtools
pax
python-dmidecode
oddjob
wodim
sgpio
genisoimage
device-mapper-persistent-data
systemtap-client
abrt-gui
qt-mysql
desktop-file-utils
ant
rpmdevtools
jpackage-utils
rpmlint
samba-winbind
certmonger
openldap-clients
pam_krb5
krb5-workstation
ldapjdk
samba
krb5-server
netpbm-progs
ImageMagick
slapi-nis
tcp_wrappers
openmotif
xterm
xorg-x11-xdm
libXmu
libXp
python-saslwrapper
perl-DBD-MySQL
dnsmasq
radvd
ebtables
sg3_utils
perl-DBD-SQLite
perl-Mozilla-LDAP
rdesktop
atlas
compat-openmpi
numpy
compat-openmpi-psm
p11-kit-trust
hmaccalc
crypto-utils
scrub
libvirt-java
mod_auth_kerb
mod_nss
certmonger
perl-CGI
python-memcached
mod_revocator
memcached
%end[root@source ~]# grep mod_nss anaconda-ks.cfg
mod_nss
過濾指定行:
[oracle@source ~]$ cat .bash_profile
# .bash_profile
# Get the aliases and functions
if [ -f ~/.bashrc ]; then
. ~/.bashrc
fi
# User specific environment and startup programs
PATH=$PATH:$HOME/bin
export PATH
export EDITOR=vi
export ORACLE_SID=test
export ORACLE_BASE=/u01/app/oracle
export ORACLE_HOME=$ORACLE_BASE/product/11.2.0/dbhome_1
export LD_LIBRARY_PATH=$ORACLE_HOME/lib
export PATH=$ORACLE_HOME/bin:/bin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/X11R6/bin
umask 022
[oracle@source ~]$ sed -n 1p .bash_profile
# .bash_profile
來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/29802484/viewspace-2114772/,如需轉載,請註明出處,否則將追究法律責任。
相關文章
- 通過NSInputStream讀取大檔案的指定起始內容
- git檢視指定提交檔案的內容Git
- 替換文字檔案中指定的內容
- 怎麼透過Python獲取檔案指定行的內容?Python
- c 刪除檔案中指定的部分內容 (轉)
- git將指定內容寫入檔案Git
- 【ZIP】打包過濾指定目錄和檔案
- 刪除指定日期內的過期檔案
- Liunx運維(三)-檔案過濾及內容編輯處理運維
- whatsns模板檔案中如何呼叫指定類目下的內容
- linux批量替換指定資料夾中所有檔案的指定內容Linux
- 刪除指定資料夾的檔案內容的sh指令碼指令碼
- Linux檔案過濾及內容編輯處理命令總結!Linux
- [grep] grep -R -l 遞迴過濾資料夾中檔案內容遞迴
- jQuery load()方法載入指定檔案內容jQuery
- 第三章 檔案過濾及內容編輯處理命令
- java檔案相關(檔案追加內容、檔案內容清空、檔案內容讀取)Java
- 複習Linux如何顯示檔案指定行數的內容Linux
- 修改過的專案內容
- 在vue裡,下載自定義內容的檔案Vue
- chapter4:內容過濾及分類---基於物品屬性的過濾APT
- 檔案字尾名的過濾
- Silverlight 讀取嵌入在.xap檔案中的檔案內容
- jQuery如何過濾排除指定的元素jQuery
- java通過檔案頭內容判斷檔案型別Java型別
- 用 tr 過濾檔案
- vite vue-cli 讀取檔案原始內容 使用base64內容的檔案ViteVue
- 反射-通過反射執行配置檔案內容反射
- 如何編輯PDF檔案的內容?
- 檢視檔案內容的特殊方法
- oracle redo檔案記錄的內容Oracle Redo
- jquery實現的設定指定元素的文字內容和html內容jQueryHTML
- DFA演算法之內容敏感詞過濾演算法
- jQuery選擇器——內容過濾選擇器jQuery
- 利用jquery實現的向指定元素追加指定內容jQuery
- 檔案內容拷貝
- Oracle 控制檔案內容Oracle
- 檔案內容比較