[ale] simple awk tolower question

Yu, Jerry Jerry.Yu at Voicecom.com
Mon Mar 28 14:37:32 EST 2005


tr [:upper:] [:lower:] <  /tmp/new_users.txt >
/tmp/lowerCasedVersionOf_new_users.txt

# -----Original Message-----
# From: ale-bounces at ale.org [mailto:ale-bounces at ale.org] On 
# Behalf Of Greg Freemyer
# Sent: Monday, March 28, 2005 2:27 PM
# To: Atlanta Linux Enthusiasts
# Subject: Re: [ale] simple awk tolower question
# 
# On Mon, 28 Mar 2005 14:19:23 -0500, Christopher Bergeron 
# <christopher at bergeron.com> wrote:
# > Can anyone help me with this one?  It's an apparently simple awk 
# > statement, however, I'm not getting the expected result.
# > 
# > I have a text file that has a name in it (/tmp/new_users.txt).
# > 
# > $ cat /tmp/new_users.txt
# > Smith
# > 
# > I'm trying to convert it to lower case.  Easy enough right?  Here's 
# > what I'm trying:
# > 
# > $ awk "{ print tolower($1) }" /tmp/new_users.txt
# > awk: cmd. line:1: fatal: 0 is invalid as number of arguments for 
# > tolower
# > 
# > The file may contain multiple lines, so I'd like to convert all the 
# > lines to all lowercase.  I won't have any funny characters, just 
# > alphanumeric.
# > 
# > Any ideas?
# > 
# > Thanks in advance to they whom help me.
# > -CB
# 
# Your trying to pass "$1" to awk, right?
# 
# If so, you need single quotes I think
# 
# awk '{ print tolower($1) }' /tmp/new_users.txt
# 
# or try a '\' in front of the $ sign, like
# 
# awk "{ print tolower(\$1) }" /tmp/new_users.txt
# 
# And finally, you talk about lines.  IIRC $0 is the entire 
# line, not $1.  $1 is just the first field.
#  
# FYI: You can also do this with tr I believe, and tr is easier 
# to use for simple tasks.
# 
# --
# Greg
# --
# Greg Freemyer
# The Norcross Group
# Forensics for the 21st Century
# _______________________________________________
# Ale mailing list
# Ale at ale.org
# http://www.ale.org/mailman/listinfo/ale
# 

This email and any attached files herein contain information that is intended only for the use of the individual or entity to whom it is addressed and may contain information that is legally privileged, confidential or otherwise exempt from disclosure under applicable laws. If the reader of this message is not the recipient, any disclosure, dissemination, distribution, copying or other use or retention of this communication or its substance is prohibited.




More information about the Ale mailing list