Sponsored Content
Top Forums Shell Programming and Scripting Comparing string's with space Post 302817757 by Xedrox on Thursday 6th of June 2013 11:52:33 AM
Old 06-06-2013
Comparing string's with space

How can i comparing string's whith blank spaces?

I have this problem:

Code:
DIF1="STRING 1212"
DIF2="STRING 1212"
if [ ${DIF1} != ${DIF2} ]
then		
       echo "Differents"			
else
	echo "Equals"
fi

Error:

Code:
1212}: unknown test operator

Thanks!
 

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

comparing 2 string variables in unix

search=Jul 22 date=Jul 22 if then echo They match >>this piece of code does not detect that search and date are equivalent strings.. what's wrong with it? (17 Replies)
Discussion started by: katdaniel16
17 Replies

2. Shell Programming and Scripting

Comparing string and integer in IF

hi, I need to create an IF condition. I read a line from a file and get the 5 word using space as a delimited. This word can have only two values either '*' or '1-5' I need to write an IF condition for two cases. I can either compare it to * or 1-5(or even 1 by cutting and getting only the... (3 Replies)
Discussion started by: kaushys
3 Replies

3. Shell Programming and Scripting

Comparing a variable to a string

Hi, I am trying to write a script to show the status of a Network card. Variables: chosennic is a read variable statuss=`/sbin/ifconfig $chosennic | grep MTU | awk '{print $1}'` ipadd=`/sbin/ifconfig $chosennic | grep Bcast | awk '{print $2}' | awk -F : '{print $2}'`... (2 Replies)
Discussion started by: mikejreading
2 Replies

4. Programming

string comparing in C

Hello, I need help with a program I'm trying to write for my moms science class, what it has to do is accept a user inputed string and search for it in a text file (file contains all the elements) The file looks like: H Hydrogen 1 He Helium 2 Li Lithium 3 Be Beryllium 4 ... If the... (1 Reply)
Discussion started by: duvalC
1 Replies

5. Programming

string comparing in C

Hello, I need help with a program I'm trying to write for my moms science class, what it has to do is accept a user inputed string and search for it in a text file (file contains all the elements) The file looks like: H Hydrogen 1 He Helium 2 Li Lithium 3 Be Beryllium 4 ... If the... (0 Replies)
Discussion started by: duvalC
0 Replies

6. Shell Programming and Scripting

Problem in comparing 2 files string by string

Hi Champs, I am a newbie to unix world, and I am trying to built a script which seems to be far tough to be done alone by me..... " I am having a raw csv file which contains around 50 fields..." From that file I have to grep 2 fields "A" and "B"....field "A" is to be aligned vertically... (11 Replies)
Discussion started by: jitendra.pat04
11 Replies

7. UNIX for Dummies Questions & Answers

Comparing a String variable with a string literal in a Debian shell script

Hi All, I am trying to to compare a string variable with a string literal inside a loop but keep getting the ./testifstructure.sh: line 6: #!/bin/sh BOOK_LIST="BOOK1 BOOK2" for BOOK in ${BOOK_LIST} do if then echo '1' else echo '2' fi done Please use next... (1 Reply)
Discussion started by: daveu7
1 Replies

8. Shell Programming and Scripting

Comparing a command with a string

Is this possible? If so it seems like a very easy and short script.I'd like to make a script that will print a friendly message but only if it is on your personal terminal. so the code would look like this: #!/bin/csh if ; then echo "This is a friendly message :D "; fi thats what i have... (4 Replies)
Discussion started by: Waffles
4 Replies

9. Shell Programming and Scripting

How to append a string by comparing another string?

Hi , I have one file like BUD,BDL BUDCAR BUD,BDL BUDLAMP ABC,CDF,KLT ABISKAR ABC,CDF,KLT CORNEL ABC,CDF,KLT KANNAD JKL,HNM,KTY,KJY JAGAN JKL,HNM,KTY,KJY HOUSE JKL,HNM,KTY,KJY KATAK JKL,HNM,KTY,KJY KOLKA The o/p should be like BUD,BDL BUDCAR,BUDLAMP ABC,CDF,KLT... (4 Replies)
Discussion started by: jagdishrout
4 Replies

10. UNIX for Advanced & Expert Users

Help comparing string, please

Good morning, I need compare this string. if || || ; then But this line not work, somebody can say me what is the error. Thank you for advanced. (5 Replies)
Discussion started by: systemoper
5 Replies
TSI(5F) 																   TSI(5F)

NAME
tsi - Transmission Subscriber Identification (TSI) access control list DESCRIPTION
The HylaFAX configuration parameter QualifyTSI specifies whether or not the identity of a calling facsimile machine should be checked against an access control list before receiving facsimile. If QualifyTSI is non-null, then only messages from facsimile machines identi- fied in the file specified by the string (typically etc/tsi) will be accepted. Patterns are specified one per line and must conform to the regular expressions syntax specified by POSIX 1003.2; see re_format(7). Com- ments may be included; they are introduced with the ``#'' character and extend to the end of the line. Any trailing white space on a line is ignored (for convenience when comments are used). If a line begins with ``!'', then the regular expression identifies clients that should be rejected; otherwise regular expressions identify clients whose transmissions should be accepted. The order of patterns in a TSI file is important. When a facsimile is to be received, the fax server will compare the client's TSI against the patterns in the access control list in the order in which they appear in the file. The first pattern that matches the client TSI is used to decide whether to accept or reject the facsimile. If no patterns match the client TSI then the facsimile is rejected. Thus if you want to accept all but a restricted set of TSI the last line in the file should be ``^.*$''. Note that regular expression patterns should be written to match a TSI exactly. That is, patterns should be of the form: ^<pattern>$ where the ``^'' and ``$'' characters are used to specify the start and end of the matching TSI. Additionally, regular expression patterns should handle white space that may appear in known locations. For example, ^([+]1){1}[ .-]*415[ .-]*555[ .-]*1212.*$ matches the following TSI strings: +1.415.555.1212 415 555 1212 1-415-555-1212 Finally, note that regular expressions can be used to specify many TSI with one pattern. NOTES
It would be nice if TSI that were to be matched against were placed in some canonical form (e.g. remove white space and white space-like characters). This is, however, problematic, because some facsimile machines permit any printable ASCII string to be sent as a TSI. SEE ALSO
faxgetty(8C), re_format(7), hylafax-config(5F) December 5, 1994 TSI(5F)
All times are GMT -4. The time now is 02:58 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy