The UNIX and Linux Forums  

Go Back   The UNIX and Linux Forums > Top Forums > Shell Programming and Scripting
Google UNIX.COM


Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts here.

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
Search, replace string in file1 with string from (lookup table) file2? gstuart Shell Programming and Scripting 2 04-11-2008 11:32 AM
Ksh Checking if string has 2 characters and does not contain digits? developncode UNIX for Dummies Questions & Answers 1 04-08-2008 12:19 PM
checking for empty string in tcsh pagod Shell Programming and Scripting 3 12-07-2007 01:22 AM
Checking the header and trailer for a given string and if not found, exit out of the er_ashu UNIX for Dummies Questions & Answers 2 11-08-2007 05:55 AM
Checking if string contains integer haz Shell Programming and Scripting 7 09-10-2006 11:51 PM

Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 03-20-2008
Registered User
 

Join Date: Feb 2008
Posts: 10
Checking for the presence of a string within another string

How to check if a string in contained in another string ?

Like

Whether the String "brown" is contained in
"A quick brown fox jumps over a lazy the dog"
Reply With Quote
Forum Sponsor
  #2 (permalink)  
Old 03-20-2008
DukeNuke2's Avatar
Soulman
 

Join Date: Jul 2006
Location: Germany, Berlin
Posts: 1,190
maybe something like this:

Code:
echo $string1 | grep $string2
Reply With Quote
Google UNIX.COM
Reply

Thread Tools
Display Modes




All times are GMT -7. The time now is 04:44 AM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited.
The UNIX and Linux Forums Content Copyright ©1993-2008 The CEP Blog All Rights Reserved -Ad Management by RedTyger Visit The Global Fact Book

Content Relevant URLs by vBSEO 3.2.0