![]() |
Hello and Welcome from United States to the UNIX and Linux Forums! Thank You for Visiting and Joining Our Global Community.
|
|
google unix.com
|
|||||||
| Forums | Register | Forum Rules | Links | Albums | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
| UNIX for Advanced & Expert Users Expert-to-Expert. Learn advanced UNIX, UNIX commands, Linux, Operating Systems, System Administration, Programming, Shell, Shell Scripts, Solaris, Linux, HP-UX, AIX, OS X, BSD. |
More UNIX and Linux Forum Topics You Might Find Helpful
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| problem in awk command | viveksnv | Shell Programming and Scripting | 3 | 03-03-2008 04:59 AM |
| problem with dd command or maybe AFS problem | Anta | Shell Programming and Scripting | 0 | 08-25-2006 10:10 AM |
| ls command problem | buckhtr77 | SUN Solaris | 2 | 12-06-2005 04:16 PM |
| Problem while using Sed command | gopskrish | UNIX for Dummies Questions & Answers | 2 | 06-27-2005 11:26 AM |
| Sed command problem | tomapam | Shell Programming and Scripting | 1 | 12-20-2002 08:02 AM |
![]() |
|
|
LinkBack | Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
||||
|
problem with tr command
Hi,
![]() Pls consider the following function and function Call normalize() { # Return string with first char uppercase, next two lowercase echo -n $1 | cut -c1 | tr '[[:lower:]]' '[[:upper:]]' echo $1 | cut -c2-3| tr '[[:upper:]]' '[[:lower:]]' } day="$(normalize mon)" when i print the value of "day" ,It is printing like "M on" which should be "Mon". I want to remove the additional space at the time of translation. Any help pls. cheers RK |
|
||||
|
Code:
day=""
normalize()
{
# Return string with first char uppercase, next two lowercase
day=$(echo $1 | cut -c1 | tr '[[:lower:]]' '[[:upper:]]')
day=${day}$(echo $1 | cut -c2-3| tr '[[:upper:]]' '[[:lower:]]')
}
normalize mon
|
| Sponsored Links | ||
|
|
![]() |
| Bookmarks |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|