8.打印第2行到匹配到dev之间的行
9.除3~16行之间的数据,将其它数据输出
以下主要正则正则匹配的实战练习
先准备数据文件,通过cat命令查看java.conf文件
[root@localhost test]#
[root@localhost test]# cat java.conf
# System-wide Java configuration file -*- sh -*-
# Location of jar files on the system
JAVA_LIBDIR=/usr/share/java
# Location of arch-specific jar files on the system
JNI_LIBDIR=/usr/lib/java
# Root of all JVM installations
JVM_ROOT=/usr/lib/jvm
# You can define a system-wide JVM root here if you're not using the
# default one.
#
# If you have a base JRE package installed
# (e.g. java-1.6.0-openjdk):
#JAVA_HOME=$JVM_ROOT/jre
#
# If you have a devel JDK package installed
# (e.g. java-1.6.0-openjdk-devel):
#JAVA_HOME=$JVM_ROOT/java
# Options to pass to the java interpreter
#JAVACMD_OPTS=
# You can disable ABRT Java Connector by setting JAVA_ABRT to "off".
# See: https://github.com/jfilak/abrt-java-connector/
#JAVA_ABRT=off
[root@localhost test]#
- 过滤掉注释的行,备注:注释的行是以#开头
- 过滤掉所有的空行