Sponsored Content
Top Forums Shell Programming and Scripting Uppercase/lowercase comparison of one character per line with awk?? Post 302385060 by alister on Thursday 7th of January 2010 03:09:51 AM
Old 01-07-2010
Hey, durden_tyler:

From what I gathered, the columns mean what you think they mean, but comparison is only made between corresponding upper-lower case letters (A-a, C-c, G-g, T-t) wherein at least one member of the pair occurs in the line. Also, there are as many duplicates of each line as there are comparisons to be made.

Line 8 will have appended to it the result of comparing A-a (columns 2 and 6), a "+". Line 9 is C-c (columns 3 and 7), and gets "-". Line 10 is for the comma-dot comparison (in this case, a "+"). If there are no instances of either member of a pair, there is no comparison made and no line is dupe appears for it.

alister
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

uppercase to lowercase

Greetings & Happy New Years To All! A client of mine FTP'ed their files up to the server and it all ended up being in UPPERCASE when it all should be in lowercase. Is there a builtin command or a script anyone knows of that will automagically convert all files to lowercase? Please advise asap... (4 Replies)
Discussion started by: webex
4 Replies

2. Shell Programming and Scripting

How convert lowercase or uppercase

It will only accept one argument where it should be upper or lowercase. if user choose to convert filnames to upper case than it should convert to upper or vice versa. if no action taken by the user then should not do anything any of the files in the current directory. (5 Replies)
Discussion started by: Alex20
5 Replies

3. Shell Programming and Scripting

UPPERCASE to lowercase with no overwriting?

Hey, I've just started learning shell script today. How would I write a bash script file that changes file names from uppercase to lowercase in that directory, the program should warn the user and NOT overwrite the existing file if it's already in lowercase? for example in a directory i... (1 Reply)
Discussion started by: lgd923
1 Replies

4. 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

5. 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

6. Shell Programming and Scripting

indentation and lowercase to uppercase

hi, i need to write a bash script that does two things. the program will take from the command line a file name, which is a C code, and an integer, which is the size of my indentation i would then have to indent every nested code by the number of columns provided by the user in the... (1 Reply)
Discussion started by: kratos.
1 Replies

7. UNIX Desktop Questions & Answers

Unix: lowercase to uppercase

I just started to learn unix... and i needed to make a basic script. i need to 1. read a file (.txt) 2. count the words of EVERY sentece 3. sentences with odd number of words need to be converted into lowercase sentences with even number of words need to be converted into uppercase ... (6 Replies)
Discussion started by: chilli1988
6 Replies

8. 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

9. Shell Programming and Scripting

Convert lowercase to uppercase

listprocs.sh contains ps -ef | grep "swikar" 1) Write a shell script to convert an input file to all upper case. Name your shell script toupper.sh. Hint: tr ' ' ' ' will convert all lower case letters to upper case To use your script, try the following command: cat... (1 Reply)
Discussion started by: swikar
1 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
u8_strcmp(3C)						   Standard C Library Functions 					     u8_strcmp(3C)

NAME
u8_strcmp - UTF-8 string comparison function SYNOPSIS
#include <sys/u8_textprep.h> int u8_strcmp(const char *s1, const char *s2, size_t n, int flag, size_t version, int *errnum); PARAMETERS
s1, s2 Pointers to null-terminated UTF-8 strings n The maximum number of bytes to be compared. If 0, the comparison is performed until either or both of the strings are exam- ined to the string terminating null byte. flag The possible comparison options constructed by a bit-wise-inclusive-OR of the following values: U8_STRCMP_CS Perform case-sensitive string comparison. This is the default. U8_STRCMP_CI_UPPER Perform case-insensitive string comparison based on Unicode upper case converted results of s1 and s2. U8_STRCMP_CI_LOWER Perform case-insensitive string comparison based on Unicode lower case converted results of s1 and s2. U8_STRCMP_NFD Perform string comparison after s1 and s2 have been normalized by using Unicode Normalization Form D. U8_STRCMP_NFC Perform string comparison after s1 and s2 have been normalized by using Unicode Normalization Form C. U8_STRCMP_NFKD Perform string comparison after s1 and s2 have been normalized by using Unicode Normalization Form KD. U8_STRCMP_NFKC Perform string comparison after s1 and s2 have been normalized by using Unicode Normalization Form KC. Only one case-sensitive or case-insensitive option is allowed. Only one Unicode Normalization option is allowed. version The version of Unicode data that should be used during comparison. The following values are supported: U8_UNICODE_320 Use Unicode 3.2.0 data during comparison. U8_UNICODE_500 Use Unicode 5.0.0 data during comparison. U8_UNICODE_LATEST Use the latest Unicode version data available, which is Unicode 5.0.0. errnum A non-zero value indicates that an error has occurred during comparison. The following values are supported: EBADF The specified option values are conflicting and cannot be supported. EILSEQ There was an illegal character at s1, s2, or both. EINVAL There was an incomplete character at s1, s2, or both. ERANGE The specified Unicode version value is not supported. DESCRIPTION
The u8_stcmp() function internally processes UTF-8 strings pointed to by s1 and s2 based on the corresponding version of the Unicode Stan- dard and other input arguments and compares the result strings in byte-by-byte, machine ordering. When multiple comparison options are specified, Unicode Normalization is performed after case-sensitive or case-insensitive processing is performed. RETURN VALUES
The u8_strcmp() function returns an integer greater than, equal to, or less than 0 if the string pointed to by s1 is greater than, equal to, or less than the string pointed to by s2, respectively. When u8_strcmp() detects an illegal or incomplete character, such character causes the function to set errnum to indicate the error. After- ward, the comparison is still performed on the resultant strings and a value based on byte-by-byte comparison is always returned. EXAMPLES
Example 1 Perform simple default string comparison. #include <sys/u8_textprep.h> int docmp_default(const char *u1, const char *u2) { int result; int errnum; result = u8_strcmp(u1, u2, 0, 0, U8_UNICODE_LATEST, &errnum); if (errnum == EILSEQ) return (-1); if (errnum == EINVAL) return (-2); if (errnum == EBADF) return (-3); if (errnum == ERANGE) return (-4); Example 2 Perform upper case based case-insensitive comparison with Unicode 3.2.0 date. #include <sys/u8_textprep.h> int docmp_caseinsensitive_u320(const char *u1, const char *u2) { int result; int errnum; result = u8_strcmp(u1, u2, 0, U8_STRCMP_CI_UPPER, U8_UNICODE_320, &errnum); if (errnum == EILSEQ) return (-1); if (errnum == EINVAL) return (-2); if (errnum == EBADF) return (-3); if (errnum == ERANGE) return (-4); return (result); } Example 3 Perform Unicode Normalization Form D. Perform Unicode Normalization Form D and upper case based case-insensitive comparison with Unicode 3.2.0 date. #include <sys/u8_textprep.h> int docmp_nfd_caseinsensitive_u320(const char *u1, const char *u2) { int result; int errnum; result = u8_strcmp(u1, u2, 0, (U8_STRCMP_NFD|U8_STRCMP_CI_UPPER), U8_UNICODE_320, &errnum); if (errnum == EILSEQ) return (-1); if (errnum == EINVAL) return (-2); if (errnum == EBADF) return (-3); if (errnum == ERANGE) return (-4); return (result); } ATTRIBUTES
See attributes(5) for descriptions of the following attributes: +-----------------------------+-----------------------------+ | ATTRIBUTE TYPE | ATTRIBUTE VALUE | +-----------------------------+-----------------------------+ |Interface Stability |Committed | +-----------------------------+-----------------------------+ |MT-Level |MT-Safe | +-----------------------------+-----------------------------+ SEE ALSO
u8_textprep_str(3C), u8_validate(3C), attributes(5), u8_strcmp(9F), u8_textprep_str(9F), u8_validate(9F) The Unicode Standard (http://www.unicode.org) SunOS 5.11 12 Sep 2007 u8_strcmp(3C)
All times are GMT -4. The time now is 05:42 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy