Removing the overlay scrollbar in Ubuntu 11.04


The overlay scrollbar in Ubuntu 11.04 that is not always visible and not very usable either really bugs me. Here is how to get rid of it, the hard way:

$ sudo apt-get remove overlay-scrollbar liboverlay-scrollbar-0.1-0

Bash-Fu: Replacing text in multiple files with one Perl command


When I posted  Bash-Fu: Replacing text in multiple files in one line, I knew that there would be a simpler way to achieve that. Thanks to my former colleague Ben, here is an even simpler way that uses a perl command.

$ perl -p -i -e 's/0.6-SNAPSHOT/0.7-SNAPSHOT/g' `find ./ -name pom.xml`

This command replaces the occurences of 0.6-SNAPSHOT with 0.7-SNAPSHOT in all the pom.xml files in the current directory and sub-directories. It is the usage of the find command that provides the list of files to process to the perl command.

Pay attention to the ` that surround the find command. These are not quotes but accents.

Telling Subversion to Ignore Files and Directories from the Command Line


To tell Subversion to ignore files and directories, it is necessary to set the value of the svn:ignore property. To do so, open a terminal.

Run the following command in the terminal. It will open a Nano window in the terminal to allow editing the files and folders to ignore.

svn propedit svn:ignore .

In my case, I wanted to ignore Maven and Eclipse files. I therefore added the following directories:

  • target
  • .classpath
  • .project
  • .settings

To make the changes effective, you must commit your changes:

svn commit

Bash-Fu: Replacing text in multiple files in one line


We use Maven on our project for the build. The hitch is that when we want to change version numbers after each iteration, we need to do it by hand. I think I’m missing something with regard to Maven functionality or plug-ins but that’s for another post.

I wanted to replace the version for the iteration in all modules in one single command line. Here it is:

find . -name "pom.xml" -print0 | xargs -0 grep -lr -e '0.5-SNAPSHOT' | xargs sed -i 's/0.5-SNAPSHOT/0.6-SNAPSHOT/g'

The chain of commands is comprised of three parts:

  1. Find all the pom files and print the files (print0) for the next command
  2. Grep the required text and print the file names (-l) instead of the test for the next command
  3. Replace all occurences of the text text in each file

I’m sure there a better ways to do it with both Bash and Maven. Nevertheless, this is pretty handy.

%d bloggers like this: