I have a file containg 15.000 of lines and I need help because editing all those lines by hand will take time.

For example, I have:

  |  | A              |B                |
  |  |----------------|-----------------|
  |  | Numbers        | Names           |
  |  |----------------|-----------------|
  |1.| ...            | PERSON-A        | 
  |2.|                | PERSON-B        |
  |3.|                | PERSON-C        |
  |4.|                | N-TH PERSON     |
  |5.|                | ...             |
  |6.|                | ...             |

I want the texts in the column B to be like:

  |  | A              |B                |
  |  |----------------|-----------------|
  |  | Numbers        | Names           |
  |  |----------------|-----------------|
  |1.| ...            | Person-A        | 
  |2.|                | Person-B        |
  |3.|                | Person-C        |
  |4.|                | N-th Person     |
  |5.|                | ...             |
  |6.|                | ...             |

In my file, I have names such as "BARACK O'BAMA SOMETHING ELSE", and I want to beautify that name as "Barack O'bama Something Else" all capilized.

Can some script do that for me? Any idea will be welcome. Thanks!

有帮助吗?

解决方案

You're looking for =PROPER(): it'll capitalize the first letter after every non-letter character in the string. Make a third column to accomodate this:

  |  | A              |B                |C                |
  |  |----------------|-----------------|-----------------|
  |  | Numbers        | Names           | Processed Names |
  |  |----------------|-----------------|-----------------|
  |1.| ...            | Person-A        | =PROPER(B1)     |
  |2.|                | Person-B        | =PROPER(B2)     |
  |3.|                | Person-C        | =PROPER(B3)     |
  |4.|                | N-th Person     | =PROPER(B4)     |
  |5.|                | ...             | ...             |
  |6.|                | ...             | ...             |

EDIT: Included an illustration of the resulting table.

EDIT 2: For clarification: =PROPER() will capitalize any letter appearing after something that's not a letter. In the example above, that would mean a string like "O'BAMA" would be rendered as "O'Bama", not "O'bama".

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top