Posts

Showing posts from November 15, 2018

Replacing Commands for Linux Files - Using Perl and Sed

Image
     A file may contain different types of strings, numbers, special characters, etc..,. We can directly edit the file using a file editor, but that applies to a single file only. If we wish to search and replace a particular word or number on multiple files, it is a burden to edit manually on every single file. In such situations we use Perl and Sed commands to achieve it.        In this article we are going to see how to replace strings, numbers in a file or a set of files using perl command and sed command. Using Perl:     Perl is the command interpreter of the Perl programming language . Perl has a large number of options that can be useful on the command line. In this article we will be seeing how to perform search and replace alone as stated earlier. Syntax:                            perl -pi -e 's/search/replace/g' File1 File2 File3     The above syntax is the basic one, but it differs according to the type of search and replacement (Strings, N

Blog Top Sites

Blog Log