Use the numeric tag to specify a specific part of the old object. Only the keyword points at nth in old will be replaced. Each line starts from the beginning. n can be any number from 1 to 512.
For example,/11 will replace the keyword that appears at 11th in a row.
The following are some examples:
Replace the lowercase letter a that appears for the second time with the uppercase letter:
$ Sed's/a/A/2'employee.txt
101, John Doe, CEO
102, Jason Smith, IT MAnager
103, RajReddy, SysAdmin
104, AnandRAm, Developer
105, JaneMiller, SAles Manager
In this example, create a file that contains the following three rows:
$ Visubstitute-locate.txt
Locate command isused to locate files
Locate command usesdatabase to locate files
Locate command canalso use regex for searching
In the file you just created, replace the locate that appears for the second time with find:
$ Sed's/locate/find/2' substitute-locate.txt
Locate command isused to findfiles
Locate command usesdatabase to findfiles
Locate command canalso use regex for searching
Note: There is only one locate in the third row in the preceding example, so there is no change in the third row.
This article is from the "old studio" blog, please be sure to keep this source http://lduan.blog.51cto.com/5428084/1303225