Sponsored Content
Top Forums UNIX for Beginners Questions & Answers Shell script ouput conversion Post 303043758 by Chubler_XL on Wednesday 5th of February 2020 04:44:52 PM
Old 02-05-2020
You should have a look at the awk tolower() function.

In your case you want to replace field #1 with a lowercase version of it's self something like this:

Code:
/NAME/ { $1=tolower($1); printf "%s" $0 }


or try
Code:
                {for (i=1; i<=NF; i++)  {gsub (/^ *| *$/, "", $i)
                                         $i = "\"" (i == 1 ? tolower($1) : $i) "\""
                                        }
                }

If you go with the above method, remember the expressions following will now be looking for lowercase a version (ie /basedir/ instead of /BASEDIR/).
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

shell script conversion to binary

My question is: i have a script called getevent to run i just call ./getevent can i convert this to make it binary executable and not letting my clients open it and see the code.??:( I am using Solaris 8. (3 Replies)
Discussion started by: bcheaib
3 Replies

2. Shell Programming and Scripting

Help me with file conversion [Shell Script]

Hello Group, I request your help with a shell script for filter an ascii file (this is small piece of the file): 09/24/2009,00:00,1.0268,1.0268,1.0249,1.0250,518 09/24/2009,01:00,1.0251,1.0261,1.0249,1.0259,424 09/24/2009,02:00,1.0258,1.0272,1.0258,1.0269,372... (3 Replies)
Discussion started by: csierra
3 Replies

3. AIX

Need timestamp conversion shell script !!

Can anyone provide me with a ksh or bash script which will accept a timestamp (format is YYYY-MM-DD-HH24.Mi.Ss) and time offset (in hours). The output will be (timestamp passed - time offset passed deducted from it) in the same YYYY-MM-DD-HH24.Mi.Ss format. Basically I am trying to convert the... (1 Reply)
Discussion started by: shibajighosh
1 Replies

4. Shell Programming and Scripting

Limit ouput file on a shell script

I have this one::) doing jstack on JVM proccess. #!/bin/ksh # ---------------------------------------------------- # capture_jstack.sh <INTERVAL> <COUNT> # run jstack and capture output to a log file #----------------------------------------------------- # # scripts and logs are stored... (3 Replies)
Discussion started by: pointer
3 Replies

5. Shell Programming and Scripting

Shell script for CSV conversion

thanks for allowing me join your forum i have an output of linux command "who" which provides following details..... CURRENT USER/ACCT INFO 17:31:36 up 4:49, 4 users, load average: 0.03, 0.04, 0.00 USER TTY FROM LOGIN@ IDLE JCPU PCPU WHAT root :0 - 12:59 ?xdm? 4:54 0.02s /bin/sh /usr/bi... (1 Reply)
Discussion started by: ayyappancheta
1 Replies

6. Shell Programming and Scripting

Shell Script for Epoch Time Conversion

Hi there I came across this script online to convert Epoch time to proper date format, but I am receiving the following error Also, I have HISTTIMEFORMAT set in user's .profile so that their history output shows time stamps. Additionally I have changed their .history location to a dedicated... (9 Replies)
Discussion started by: hedkandi
9 Replies

7. Shell Programming and Scripting

Conversion batch shell script

while converting batch file to shell script ...dis command is ther i dunno how to change...can anyone knws how to change into shell script rm !(D:\temp\XX.txt) (3 Replies)
Discussion started by: monisha
3 Replies

8. Shell Programming and Scripting

Batch to shell script conversion

Hi All, I have a small tool which is currently configured in batch scripts only. But my need is to run it on Linux platform, so I have been trying to convert a batch script to shell script. below is the batch script: @echo off IF "%1"== "" GOTO ARGERR REM UPDATE THESE PROPERTIES TO... (2 Replies)
Discussion started by: sukhdip
2 Replies

9. Shell Programming and Scripting

Shell Script has different ouput via cron vs when run Manually

Hello Lads, I deployed a script on my mac to start and stop EC2 instances on AWS console. The script when started manually on the terminal does the expected stop and start. Problem is when i try to schedule it on a cron, it fails to recognize the AWS Keys which i set up as ENV variable by... (2 Replies)
Discussion started by: Irishboy24
2 Replies

10. UNIX for Beginners Questions & Answers

powershell script to unix shell script conversion.

Here is a powershell script to use restful API to create ticket in our ticketing tool. Can anyone please convert it to a shell script sothat, I can run it in Unix servers, below is the code: $body = @{ Customer= ''test' Summary= 'test summary' Impact= '4-Minor/Localized' ... (2 Replies)
Discussion started by: pandeybhavesh18
2 Replies
conv(3) 						     Library Functions Manual							   conv(3)

NAME
toascii, tolower, _tolower, toupper, _toupper - Translate characters LIBRARY
Standard C Library (libc.so, libc.a) SYNOPSIS
#include <ctype.h> int toascii( int c); int tolower( int c); int _tolower( int c); int toupper( int c); int _toupper( int c); STANDARDS
Interfaces documented on this reference page conform to industry standards as follows: toascii(), tolower(), _tolower(), toupper(), _toupper(): XPG4, XPG4-UNIX Refer to the standards(5) reference page for more information about industry standards and associated tags. PARAMETERS
Specifies the character to be converted. DESCRIPTION
The toascii(), tolower(), _tolower(), toupper(), and _toupper() functions translate all characters, including multibyte characters, to their specified character values. The toascii() function converts its input to a 7-bit ASCII character. The tolower() function takes an int value that can be represented as an unsigned char or the value of EOF (defined in the stdio.h header file) as its input. When the input of the tolower() function expresses an uppercase letter, and there exists a corresponding lowercase letter (as defined by character type information in the program locale category LC_CTYPE), the corresponding lowercase letter is returned. All other input val- ues in the domain are returned unchanged. The tolower() function has as its domain the range -1 through 255. In the C locale, or in a locale where case-conversion information is not defined, the tolower() function determines the case of characters according to the rules of the Portable Character Set (ASCII characters). Characters outside the ASCII range of characters are returned unchanged. The _tolower() macro is equivalent to the tolower() function, but executes faster. If the value of the c parameter to the _tolower() macro does not have a corresponding lowercase character, the results of the function are undefined. The toupper() function takes an int value that can be represented as an unsigned char or the value of EOF (defined in the stdio.h header file) as its input. When the input of the toupper() function expresses a lowercase letter, and there exists a corresponding uppercase letter (as defined by character type information in the program locale category LC_CTYPE), the corresponding uppercase letter is returned. All other input val- ues in the domain are returned unchanged. The toupper() function has as its domain the range -1 through 255. In the C locale, or in a locale where case-conversion information is not defined, the toupper() function determines the case of characters according to the rules of the Portable Character Set (ASCII characters). Characters outside the ASCII range of characters are returned unchanged. The _toupper() macro is equivalent to the toupper() function, but executes faster. If the value of the c parameter to the _toupper() macro does not have a corresponding uppercase character, the results of the function are undefined. NOTES
The LC_CTYPE category of the current locale affects all conversions. See the i18n_intro(5) reference page for more information on locale variables. RETURN VALUES
The toascii() function returns the logical AND of parameter c and the value 0X7F. When the c parameter is a character for which the isupper() function is TRUE, there is a corresponding character for which the islower() function is also TRUE. That lowercase character is returned by the tolower() function or by the _tolower() macro. Otherwise, the c parame- ter is returned unchanged. When the c parameter is a character for which the islower() function is TRUE, there is a corresponding character for which the isupper() function is also TRUE. That uppercase character is returned by the toupper() function or by the _toupper() macro. Otherwise, the c parame- ter is returned unchanged. RELATED INFORMATION
Functions: ctype(3) Other: i18n_intro(5), standards(5) delim off conv(3)
All times are GMT -4. The time now is 12:58 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy