|
CentOS Linux Server Guide |
Replacing words and characters of a file in CentOS Linux |
|||||||||||||||
tr - also known as 'Translate' for Linux or Unix. This is the command to find and replacin words and character for a given files
Command and Options: tr [options] string1 string2
Warning: You must be extra careful when applying this command, all the redirection must be in the following
tr abc ABCD < A.log (OK!)
However, you issue the wrong redirection command, you will destroy all the contents of the file
tr abc ABCD > A.log (WRONG!)
Option:
Examples:
The the following example will replacing character of "abcd" with "ABCD"
The following example will replacing all the lowercase characters (character to a-z) with Uppercase (character A to Z)
The following example will replace any characters of a file with "#" , EXCEPT number
|
|||||||||||||||
|
Copyright 2011 http://www.1a-centosserver.com All Rights Reserved All trademarks are the property of their respective owners. Contact Us | Terms of Use | Privacy Policy |