Sponsored Content
Top Forums Shell Programming and Scripting What is wrong with tiny (g)awk line ?? Post 302606411 by Scrutinizer on Sunday 11th of March 2012 09:28:57 AM
Old 03-11-2012
I am guessing the back reference \\1 does not get passed to the toupper function inside the replacement part of gawk's gensub function:

Alternatively:
Code:
awk '{for(i=1;i<=NF;i++)$i=toupper(substr($i,1,1)) substr($i,2)}1'  infile

but that would squeeze spacing..

Or shortening the previous perl:
Code:
perl -pe 's/\b./\u$&/g' infile

 

3 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

what is wrong with this line?

system ("$ssh '$perf_stats' < temp_pipe 2>&1 &"); I need to start and interact with my executable defined by perf_stats on a remote machine but not change my command line to that of the remote machine. temp_pipe is a node created by mknod -f temp_pipe (6 Replies)
Discussion started by: looza
6 Replies

2. Shell Programming and Scripting

what is wrong with this expr line

It keeps giving me expr syntax error. expr "${etherline }" : ’.*no match found’ 2>&1 >/dev/null Thanks in advance. (1 Reply)
Discussion started by: shadow_boi
1 Replies

3. Shell Programming and Scripting

what's wrong with my awk line?

] && { echo "The free mem need to be more than 2G" } (3 Replies)
Discussion started by: yanglei_fage
3 Replies
TOUPPER(3)						   BSD Library Functions Manual 						TOUPPER(3)

NAME
toupper, toupper_l -- lower case to upper case letter conversion LIBRARY
Standard C Library (libc, -lc) SYNOPSIS
#include <ctype.h> int toupper(int c); #include <ctype.h> #include <xlocale.h> int toupper_l(int c, locale_t loc); DESCRIPTION
The toupper() function converts a lower-case letter to the corresponding upper-case letter. The argument must be representable as an unsigned char or the value of EOF. Although the toupper() function uses the current locale, the toupper_l() function may be passed a locale directly. See xlocale(3) for more information. RETURN VALUES
If the argument is a lower-case letter, the toupper() function returns the corresponding upper-case letter if there is one; otherwise, the argument is returned unchanged. COMPATIBILITY
The 4.4BSD extension of accepting arguments outside of the range of the unsigned char type in locales with large character sets is considered obsolete and may not be supported in future releases. The towupper() function should be used instead. SEE ALSO
ctype(3), isupper(3), towupper(3), xlocale(3) STANDARDS
The toupper() function conforms to ISO/IEC 9899:1990 (``ISO C90''). BSD
July 17, 2005 BSD
All times are GMT -4. The time now is 03:40 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy