Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Shaun E on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Changing a field to uppercase

Status
Not open for further replies.

hawaiian1975

Programmer
Nov 7, 2003
26
US
I'm trying to read in a database type of file and change the names in a field to uppercase.

For example:

tjohnson | alpha1 | 1234 | bin | Tyrone Johnson | usr |
kdickson | 211986 | 4567 | bin | Ken Dickson | home |

I want to change the fifth field into all uppercase.

Is there a short and efficient script to accomplish this?

 
asuming your file is $file here's a script to do it:

Code:
@splitfile = split / \| /, $file;
$splitfile[4] = uc($splitfile[4]);
$file = join(' | ',@splitfile);
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top