From: rickm on
I have a file that looks like this:

poly poly
metal1 metal1
metal2 metal2
metal3 metal3

but need to be able to change one column to uppercase so either:

POLY poly

From: Johann Kappacher on
rickm(a)galaxy.nsc.com wrote:
> I have a file that looks like this:
>
> poly poly
> metal1 metal1
> metal2 metal2
> metal3 metal3
>
> but need to be able to change one column to uppercase so either:
>
> POLY poly
>
I would try:

typeset -u UC

while read UC LC
do
echo "$UC \t $LC"
done < input_file

From: Johann Kappacher on
Johann Kappacher wrote:
> rickm(a)galaxy.nsc.com wrote:
>> I have a file that looks like this:
>>
>> poly poly
>> metal1 metal1
>> metal2 metal2
>> metal3 metal3
>>
>> but need to be able to change one column to uppercase so either:
>>
>> POLY poly
>>
> I would try:
>
> typeset -u UC
>
> while read UC LC
> do
> echo "$UC \t $LC"
> done < input_file
>
Perhaps, you will need to change the IFS (Input Field Separator) first.
Please, check man page or tutorial for bash or ksh.
From: Ed Morton on


On 4/7/2008 2:16 PM, rickm(a)galaxy.nsc.com wrote:
> I have a file that looks like this:
>
> poly poly
> metal1 metal1
> metal2 metal2
> metal3 metal3
>
> but need to be able to change one column to uppercase so either:
>
> POLY poly
>

This may be what you want if you don't care about preserving the white-space:

awk '{$1=toupper($1)}1' file

If you do care, tell us what that white space is.

Ed.

From: Johann Kappacher on
Ed Morton wrote:

> awk '{$1=toupper($1)}1' file
Nice solution, not strict shell, but very nice!

btw: what stands the 3rd "1" for?

--jk