Sponsored Content
Top Forums Shell Programming and Scripting How to match a exact word in a variable ???? Post 302373406 by aigles on Friday 20th of November 2009 07:16:15 AM
Old 11-20-2009
Or:
Code:
#!/bin/ksh
str="online maintenance"
if [[ "$str" = *online* ]]
then echo Yes
else echo No
fi

Jean-Pierre.
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

How to get exact match sentences?

Hi, I have sentences like this: $sent= Protein modeling studies reveal that the RG-rich region is part of a three to four strand antiparallel beta-sheet, which in other RNA binding protein functions as a platform for nucleic acid interactions. Heterogeneous nuclear ribonucleoparticle... (19 Replies)
Discussion started by: vanitham
19 Replies

2. UNIX for Dummies Questions & Answers

exact string match in a word

Hi all, Is anyone able to help with the following query? I have an input file with several lines of words, e.g. "hellolaylahello" "hellohellohellolayla" I want to search for the exact string "hello" in each line and display: 2 "hellolaylahello" 3 "hellohellohellolayla" I... (11 Replies)
Discussion started by: dr_sabz
11 Replies

3. Shell Programming and Scripting

Exact Word Match

I'm trying to find a exact word match but couldn't do it. ABC ABC_NE Searching for ABC_NE tried grep -w </ABC_NE/> grep "^ABC_NE$" but didn't worked , any awk variants would also help. ---------- Post updated at 08:40 AM ---------- Previous update was at 06:48 AM ---------- I... (2 Replies)
Discussion started by: dinjo_jo
2 Replies

4. Shell Programming and Scripting

exact string match ; search and print match

I am trying to match a pattern exactly in a shell script. I have tried two methods awk '/\<mpath${CURR_MP}\>/{print $1 $2}' multipath perl -ne '/\bmpath${CURR_MP}\b/ and print' /var/tmp/multipath Both these methods require that I use the escape character. I am guessing that is why... (8 Replies)
Discussion started by: bash_in_my_head
8 Replies

5. UNIX for Dummies Questions & Answers

Find EXACT word in files, just the word: no prefix, no suffix, no 'similar', just the word

I have a file that has the words I want to find in other files (but lets say I just want to find my words in a single file). Those words are IDs, so if my word is ZZZ4, outputs like aaZZZ4, ZZZ4bb, aaZZZ4bb, ZZ4, ZZZ, ZyZ4, ZZZ4.8 (or anything like that) WON'T BE USEFUL. I need the whole word... (6 Replies)
Discussion started by: chicchan
6 Replies

6. Shell Programming and Scripting

Exact match and #

Hi friends, i am using the following grep command for exact word match: >echo "sachin#tendulkar" | grep -iw "sachin" output: sachin#tendulkar as we can see in the above example that its throwinng the exact match(which is not the case as the keyword is sachin and string is... (6 Replies)
Discussion started by: neelmani
6 Replies

7. Shell Programming and Scripting

Match exact Variable in Awk

I want to match exact string stored in Variable INO and print next two lines. I have written below code which partially matches: awk '/\'$VAR'/{getline; getline; print}' Will be thankful , if somebody can help in to resolve this problem. Please view this code tag video for how to use... (9 Replies)
Discussion started by: nitj
9 Replies

8. Shell Programming and Scripting

awk match whole word using a variable

Hello, I am writing a script in awk where I need to match a whole word that is stored inside a variable. For example: I am working on a text that looks like this, and I want to print the second row: sfasfsomethingsfasf this is something I can use this is not somethingIcanuse ... (12 Replies)
Discussion started by: avi.levi
12 Replies

9. Shell Programming and Scripting

Replacing exact match

Hi All, My Input file contains a 1000’s of lines in which I have to replace a a string to the other. Here the problem is, I have the lines in my Input as below. Cable Yes && !Pay TV && !ADS \noUE \Label="Cable Yes && !Pay TV && !ADS" I want to replace exactly the string Cable Yes &&... (37 Replies)
Discussion started by: am24
37 Replies

10. Shell Programming and Scripting

awk to update file based on partial match in field1 and exact match in field2

I am trying to create a cronjob that will run on startup that will look at a list.txt file to see if there is a later version of a database using database.txt as the source. The matching lines are written to output. $1 in database.txt will be in list.txt as a partial match. $2 of database.txt... (2 Replies)
Discussion started by: cmccabe
2 Replies
MB_STRTOUPPER(3)							 1							  MB_STRTOUPPER(3)

mb_strtoupper - Make a string uppercase

SYNOPSIS
string mb_strtoupper (string $str, [string $encoding = mb_internal_encoding()]) DESCRIPTION
Returns $str with all alphabetic characters converted to uppercase. PARAMETERS
o $str - The string being uppercased. o $encoding -The $encoding parameter is the character encoding. If it is omitted, the internal character encoding value will be used. RETURN VALUES
$str with all alphabetic characters converted to uppercase. UNICODE
For more information about the Unicode properties, please see http://www.unicode.org/unicode/reports/tr21/. By contrast to strtoupper(3), 'alphabetic' is determined by the Unicode character properties. Thus the behaviour of this function is not affected by locale settings and it can convert any characters that have 'alphabetic' property, such as a-umlaut (a). EXAMPLES
Example #1 mb_strtoupper(3) example <?php $str = "Mary Had A Little Lamb and She LOVED It So"; $str = mb_strtoupper($str); echo $str; // Prints MARY HAD A LITTLE LAMB AND SHE LOVED IT SO ?> Example #2 mb_strtoupper(3) example with non-Latin UTF-8 text <?php $str = "Txiotn a nE Baos unuvn yn, dpaokeCei unp vw0po kuvs"; $str = mb_strtoupper($st_, 'UTF-8'); _ _ _ _ echo $str; // Prints TXI>TH A/TTHH BAO> YHMNH | H, /PA>KE/EI YTTP NOOPO KYN> ?> SEE ALSO
mb_strtolower(3), mb_convert_case(3), strtoupper(3). PHP Documentation Group MB_STRTOUPPER(3)
All times are GMT -4. The time now is 08:11 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy