VI is one of the fastest and most successful editor used by the unix users. VI can also boast of having a regular expression search feature which I found amongst easiest to use and easy to test your regular expressions as well
Consider the file pom.xml below. We are going to demonstrate a step by step way of selecting only line numbers in the file and finally performing a search and replace to remove all the leading line numbers from the text
1 <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 2 xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"> 3 <modelVersion>4.0.0</modelVersion> 4 <groupId>com.examples.spring</groupId> 5 <artifactId>HelloSpring</artifactId> 6 <packaging>jar</packaging> 7 <version>1.0-SNAPSHOT</version> 8 <name>HelloSpring</name> 9 <url>http://maven.apache.org</url> 10 <dependencies> 11 <dependency> 12 <groupId>junit</groupId> 13 <artifactId>junit</artifactId> 14 <version>3.8.1</version> 15 <scope>test</scope> 16 </dependency> 17 </dependencies> 18 </project>
Read more ...