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 and shell scripting languages here.

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
grep exact string/ avoid substring search albertashish UNIX for Dummies Questions & Answers 3 11-03-2008 12:47 PM
grep for a search string raga UNIX for Dummies Questions & Answers 11 03-12-2008 08:38 AM
grep string and output filename happyv Shell Programming and Scripting 3 11-20-2007 12:16 AM
grep: RE error 41: No remembered search string. fkaba81 Shell Programming and Scripting 2 06-22-2006 03:23 AM
Appending to filename a string of text grep finds HLee1981 Shell Programming and Scripting 3 09-06-2005 03:44 PM

 
English Japanese Spanish French German Portuguese Italian Dutch Swedish Russian Norwegian Hungarian Hebrew Danish Bulgarian Greek Powered by Powered by Google
 
LinkBack Thread Tools Search this Thread Rate Thread Display Modes
Prev Previous Post   Next Post Next
  #1 (permalink)  
Old 11-18-2008
tuathan tuathan is offline
Registered User
  
 

Join Date: Nov 2008
Posts: 10
How to search (grep?) filename for a string and if it contains this then...

Hi i want to write a script that will search a filename e.g. test06abc.txt for a string and if it contains this string then set a variable equal to something:

something like:

var1=0

search <filename> for 06
if it contains 06 then
var1=1
else
var1=0
end if

but in unix script
 

Bookmarks

Tags
grep file search if

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On




All times are GMT -4. The time now is 07:17 PM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited. Language Translations Powered by .
vBCredits v1.4 Copyright ©2007 - 2008, PixelFX Studios
The UNIX and Linux Forums Content Copyright ©1993-2009. All Rights Reserved.Ad Management by RedTyger

Content Relevant URLs by vBSEO 3.2.0