Skip to content
Archive of entries posted on January 2010

Understand Awk Variables with 3 Practical Examples

This article is part of the on-going Awk Tutorial and Examples series. Like any other programming languages, Awk also has user defined variables and built-in variables. In this article let us review how to define and use awk variables. Awk variables should begin with the letter, followed by it can consist of alpha numeric characters [...]

Quickly search and replace string with Regular expression in multiple files using perl

for i in *; do perl -p -w -e \’s/a(.*)b.*/d$1e/g\’  $i > temp/$i; done for i in *; do perl -pi -w -e \’s/a(.*)b.*/d$1e/g\’  $i ; done The first one can be used when you want to preserve the original file. The redirection will cause the file with replaced string to be written to the [...]

grep -v with multiple patterns.

$ sed \’/test/{/error|critical|warning/d}\’ somefile If you wanted to do all in one command, you could go w/ sed instead View this command to comment, vote or add to favourites View all commands by pipping by David Winterbottom (codeinthehole.com) URL: http://feedproxy.google.com/~r/Command-line-fu/~3/LjKzo7FpzDU/grep-v-with-multiple-patterns. Related articles by Zemanta Google\’s \”Show More Results\” Plus Box (seroundtable.com) See which processes are [...]