Go Back   The UNIX and Linux Forums > Top Forums > UNIX for Dummies Questions & Answers


UNIX for Dummies Questions & Answers If you're not sure where to post a UNIX or Linux question, post it here. All UNIX and Linux newbies welcome !!

Closed Thread    
 
Thread Tools Search this Thread Display Modes
    #1  
Old 06-12-2012
Registered User
 
Join Date: Jun 2012
Posts: 5
Thanks: 0
Thanked 0 Times in 0 Posts
Read complete line

Hello all,

I have following line and want to search the exact match in text file.

30 6 * * * /data/abc/abc.ksh -f xya.sql -xyz@email -x -c -g

I have tried it many ways like grep -W ,sed,etc.... but could not find the solution.

The above line i am storing it in one variable called "var" and evertime i will have different line in this variable.Can you please help me in this??
Sponsored Links
    #2  
Old 06-12-2012
Scrutinizer's Avatar
Moderator
 
Join Date: Nov 2008
Location: Amsterdam
Posts: 7,350
Thanks: 144
Thanked 1,755 Times in 1,592 Posts
Try:

Code:
var='30 6 * * * /data/abc/abc.ksh -f xya.sql -xyz@email -x -c -g'
grep -F -- "$var" file

Sponsored Links
    #3  
Old 06-12-2012
Registered User
 
Join Date: Jun 2012
Posts: 5
Thanks: 0
Thanked 0 Times in 0 Posts
Thanks for your reply But at my end -F is not working..

is there any other alternative?
    #4  
Old 06-12-2012
Scrutinizer's Avatar
Moderator
 
Join Date: Nov 2008
Location: Amsterdam
Posts: 7,350
Thanks: 144
Thanked 1,755 Times in 1,592 Posts
Are you using Solaris? Try:

Code:
/usr/xpg4/bin/grep -F -- "$var" file

or otherwise try:

Code:
fgrep -- "$var" file

Sponsored Links
    #5  
Old 06-12-2012
Registered User
 
Join Date: Jun 2012
Posts: 5
Thanks: 0
Thanked 0 Times in 0 Posts
Thanks a ton!!!!
Sponsored Links
Closed Thread

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
bash: read file line by line (lines have '\0') - not full line has read??? alex_5161 Shell Programming and Scripting 6 04-14-2010 04:58 AM
Reading complete line after spaces gupt_ash Shell Programming and Scripting 8 12-14-2009 03:17 PM
Split a line on positions before reading complete line vijaykrc Shell Programming and Scripting 1 02-18-2009 06:23 PM
Delete a word and complete line Aejaz UNIX for Advanced & Expert Users 1 05-02-2008 12:50 PM
Using the Esc key to complete command line typing jxh461 UNIX for Dummies Questions & Answers 1 06-05-2007 06:04 PM



All times are GMT -4. The time now is 07:45 AM.