Sponsored Content
Full Discussion: comparing strings
Top Forums Shell Programming and Scripting comparing strings Post 302185911 by agarwal on Wednesday 16th of April 2008 05:19:54 AM
Old 04-16-2008
Thanks a lot for your reply. What if rpttxt is not the starting string for eg:-
PAGENOUSINGrpttxt("_PAGE_NO_3")
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

comparing two strings

Hi How do i compare two strings in shell script. Below is an example but I am not getting the desired output, plz help if then echo success fi I am not getting the desired output if I do this. plz help (24 Replies)
Discussion started by: ragha81
24 Replies

2. UNIX for Advanced & Expert Users

Comparing strings

I have two strings a=Mar22 b=may21 how can I compare them Is this fine if then; . ... else .... fi or if then (2 Replies)
Discussion started by: yakyaj
2 Replies

3. Shell Programming and Scripting

Comparing Two Strings

Hi All, While I am trying to run below code I Am getting the exception like ./abs.sh: line 102: syntax error near unexpected token `then' ./abs.sh: line 102: ` then' The Code Snippet is: if then cat $file1 | sed -e... (8 Replies)
Discussion started by: Anji
8 Replies

4. Shell Programming and Scripting

comparing 2 strings

hi i have 2 strings. i want to compare the strings. please help (2 Replies)
Discussion started by: satish@123
2 Replies

5. Shell Programming and Scripting

comparing two strings

hi All i am facing prob in comparing two strings that have two word. below is the code snippet. checkValidates="file validates" file3_name="file" if then echo "file" $file3_name "is validated successfully" fi when i run this i get the error as -bash: [: too many arguments ... (1 Reply)
Discussion started by: infyanurag
1 Replies

6. Shell Programming and Scripting

Comparing strings using nawk

Hello All Please I have got a file called DATE.tex which consist of 01-04-2008_12:00:00 01-04-2005_12:00:00 01-04-2003_12:00:00 01-04-2007_12:00:00 01-04-2002_12:00:00 01-04-2009_12:00:00 I want to use nawk to print out the dates >=01-04-2009_12:00:00 I tried this cat plnt.new |... (6 Replies)
Discussion started by: ganiel24
6 Replies

7. Shell Programming and Scripting

Comparing strings with sed

Input: The the the the Output: not-same same What would be the sed command to do this? (7 Replies)
Discussion started by: cola
7 Replies

8. UNIX for Dummies Questions & Answers

Strings comparing incorrectly

Hello I'm very new to Linux and shell scripting so I only know basic stuff. I'm making a script with the purpose of finding the longest string or word in a file. Here's what I got so far: #!/bin/bash longest="" for i in $(strings -n $1); do if ] then longest=$i fi done echo $longest... (4 Replies)
Discussion started by: SCB
4 Replies

9. Shell Programming and Scripting

comparing strings as ints

Hi, So I got his code below. $year is a string of 2010,2011 etc. I guess I want to convert $year to an integer so I can do my if statement to see if the year string is greater than 2010? Or how could I do this? Right now I get a syntax error doing this. if; then do stuff fi (2 Replies)
Discussion started by: vsekvsek
2 Replies

10. Shell Programming and Scripting

Comparing Strings in ksh88

Hi I tried the following string comparison script in Ksh88 #!/bin/ksh str1='aC' str2='ABC' if then echo "Equal" else echo "Not Equal" fi Though str1 and str2 are not equal the script output says Equal . Please correct me Thanks (2 Replies)
Discussion started by: smile689
2 Replies
strxfrm(3)						     Library Functions Manual							strxfrm(3)

NAME
strxfrm - Transforms string for collation in current locale LIBRARY
Standard C Library (libc.so, libc.a) SYNOPSIS
#include <string.h> size_t strxfrm( char *s1, const char *s2, size_t n); STANDARDS
Interfaces documented on this reference page conform to industry standards as follows: strxfrm(): XPG4, XPG4-UNIX Refer to the standards(5) reference page for more information about industry standards and associated tags. PARAMETERS
Specifies the destination string. Specifies the string to be transformed. Specifies the maximum number of bytes to store in the trans- formed string. DESCRIPTION
The strxfrm() function transforms the string pointed to by the s2 parameter into an internal form suitable for collation and places the result in the address specified by s1. This transformation is performed as appropriate to the LC_COLLATE category of the current locale. When the strcmp() function is applied to two transformed strings, a value greater than, equal to, or less than 0 (zero) is returned. The returned value corresponds to the same value that is returned when the strcoll() function is applied to the same two original transformed strings. The transformed string can be longer than the original string. No more than n characters are placed in the location pointed to by the s1 parameter, including the terminating null character. When n is 0 (zero), the s1 parameter can be a null pointer. When operating on overlapping strings, the behavior of this function is unreliable. NOTES
If you are doing multiple comparisons using the same set of text strings, the strxfrm() transformation function in conjunction with the strcmp() function may be more efficient than using the strcoll() collation function because the string is transformed based on the locale tables only once. However, the transformation function must convert all characters in the string for each level of a multi-level colla- tion. In comparison, the collation function stops comparing characters at the first inequality. These efficiency tradeoffs make the most efficient method for a specific application dependent on both the number of repeated comparisons for each string and the contents of each string. RETURN VALUES
Upon successful completion, the strxfrm() function returns the number of bytes required to store the transformed string (not including the terminating null byte). If this is greater than or equal to the value of the n parameter, which specifies the maximum number of bytes that can be stored in s1, the contents of s1 are indeterminate. ERRORS
If the following condition occurs, the strxfrm() function sets errno to the corresponding value. The s2 parameter contains codes outside the domain of the collating sequence defined by the current locale. RELATED INFORMATION
Functions: setlocale(3), strcoll(3), string(3)/strcmp(3), wcsxfrm(3) Standards: standards(5) delim off strxfrm(3)
All times are GMT -4. The time now is 02:37 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy