Sponsored Content
Top Forums Shell Programming and Scripting only uppercase first character? Post 302118705 by reborg on Wednesday 23rd of May 2007 08:03:23 PM
Old 05-23-2007
A more general version for one or more words on a line:

Code:
awk '{ for ( i=1; i <= NF; i++) 
           {   sub(".", substr(toupper($i),1,1) , $i)  }  
            print }' file

use nawk/gawk/mawk as appropriate if awk doesn't work
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Converting to Uppercase

I want to convert string into uppercase string. How can i do that ? Ex: Enter the user name: read name show=upper(name) echo $show --- This output should be the uppercase output. Thanks (3 Replies)
Discussion started by: dreams5617
3 Replies

2. Shell Programming and Scripting

Conversion to uppercase - tr

Hi, I am trying to convert the $i in loop from lower to upper case but getting error like ' awk: 0602-502 The statement cannot be correctly parsed. The source line is 1.' .. Requirement: I have many table in script XXX.sql which starting with 'ABC_','AbC_','aBc_' etc.. same thing for table... (2 Replies)
Discussion started by: subrat
2 Replies

3. AIX

Lowercase to Uppercase

Inside a script I have 2 variables COMP=cy and PT=t. further down the same script I require at the same line to call those 2 variables the first time uppercase and after lowercase ${COMP}${PT}ACE,${COMP}${PT}ace. Can somebody help me Thanks in advance George Govotsis (7 Replies)
Discussion started by: ggovotsis
7 Replies

4. UNIX for Dummies Questions & Answers

uppercase to lowercase

i have no variable and no file i just want to convert AJIT to ajit with some command in UNIX can anybody help (4 Replies)
Discussion started by: ajit.yadav83
4 Replies

5. UNIX for Dummies Questions & Answers

UPPERCASE to lowercase

Hi All, i have a file and i want to convert all uppercase letters to lowercase letters which are in my file. how can i do this. Thanx (3 Replies)
Discussion started by: temhem
3 Replies

6. Shell Programming and Scripting

Uppercase/lowercase comparison of one character per line with awk??

Another frustrating scripting problem from a biologist trying to manipulate a file with several millions line. For each of the line I need to compare the uppercase A or C or G or T with the lowercase a or c or g or t. If there are more uppercases, a + should be added to a new column, otherwise a -... (10 Replies)
Discussion started by: ivpz
10 Replies

7. Shell Programming and Scripting

Change to uppercase

Hi I have a string(can be mix of upper and lower case) and need the first three chars of the string to be converted to uppercase (4 Replies)
Discussion started by: Northpole
4 Replies

8. Shell Programming and Scripting

Make the first character uppercase

Input: hello world monkey Output should be: Hello World Monkey How can it be done with perl,sed,awk or bash? (9 Replies)
Discussion started by: cola
9 Replies

9. Shell Programming and Scripting

making the first character of word using uppercase using awk and sed

I want to make the first character of some words to be uppercase. I have a file like the one below. uid,givenname,sn,cn,mail,telephonenumber mattj,matt,johnson,matt johnson,mattj@gmail.com markv,mark,vennet,matt s vennet,markv@gmail.com mikea,mike,austi,mike austin,mike@gmail.com I want... (3 Replies)
Discussion started by: matt12
3 Replies

10. Shell Programming and Scripting

Uppercase to lowercase

Hello, I have a list of files in a directory whose names are all in uppercasse, including the file format for eg *.MP3 . I would like to convert these to the normal way we write it ie ABC.MP3 to be converted to Abc.mp3 . I know that this can be done manually by using a lot of "mv" or rename... (6 Replies)
Discussion started by: ajayram
6 Replies
TOWUPPER(3)						     Linux Programmer's Manual						       TOWUPPER(3)

NAME
towupper, towupper_l - convert a wide character to uppercase SYNOPSIS
#include <wctype.h> wint_t towupper(wint_t wc); wint_t towupper_l(wint_t wc, locale_t locale); Feature Test Macro Requirements for glibc (see feature_test_macros(7)): towupper_l(): Since glibc 2.10: _XOPEN_SOURCE >= 700 Before glibc 2.10: _GNU_SOURCE DESCRIPTION
The towupper() function is the wide-character equivalent of the toupper(3) function. If wc is a lowercase wide character, and there exists an uppercase equivalent in the current locale, it returns the uppercase equivalent of wc. In all other cases, wc is returned unchanged. The towupper_l() function performs the same task, but performs the conversion based on the character type information in the locale speci- fied by locale. The behavior of towupper_l() is undefined if locale is the special locale object LC_GLOBAL_LOCALE (see duplocale(3)) or is not a valid locale object handle. The argument wc must be representable as a wchar_t and be a valid character in the locale or be the value WEOF. RETURN VALUE
If wc was convertible to uppercase, towupper() returns its uppercase equivalent; otherwise it returns wc. VERSIONS
The towupper_l() function first appeared in glibc 2.3. ATTRIBUTES
For an explanation of the terms used in this section, see attributes(7). +-------------+---------------+----------------+ |Interface | Attribute | Value | +-------------+---------------+----------------+ |towupper() | Thread safety | MT-Safe locale | +-------------+---------------+----------------+ |towupper_l() | Thread safety | MT-Safe | +-------------+---------------+----------------+ CONFORMING TO
towupper(): C99, POSIX.1-2001 (XSI); present as an XSI extension in POSIX.1-2008, but marked obsolete. towupper_l(): POSIX.1-2008. NOTES
The behavior of these functions depends on the LC_CTYPE category of the locale. These functions are not very appropriate for dealing with Unicode characters, because Unicode knows about three cases: upper, lower and title case. SEE ALSO
iswupper(3), towctrans(3), towlower(3), locale(7) COLOPHON
This page is part of release 4.15 of the Linux man-pages project. A description of the project, information about reporting bugs, and the latest version of this page, can be found at https://www.kernel.org/doc/man-pages/. GNU
2017-09-15 TOWUPPER(3)
All times are GMT -4. The time now is 06:52 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy