Wednesday, September 17, 2014

Perl : Find files using File::Find

How to find the list of files in Perl  like the UNIX find command? The answer is File::Find CPAN module. Let us see in this article how to use the File::Find module.

File::Find:
   File::Find module contains 2 modules: find and finddepth. Both are used to find the files, the difference being the order in which the files and directories are parsed. find has all the options like the Unix find command.

Wednesday, August 13, 2014

sed - 20 examples to remove / delete characters from a file

In this article of sed series, we will see the examples of how to remove or delete characters from a file. The syntax of sed command replacement is:
$ sed 's/find/replace/' file
 This sed command finds the pattern and replaces with another pattern. When the replace is left empty, the pattern/element found gets deleted.

Let us consider a sample file as below:
$ cat file
Linux
Solaris
Ubuntu
Fedora
RedHat