The UNIX and Linux Forums  
Hello and Welcome from United States to the UNIX and Linux Forums! Thank You for Visiting and Joining Our Global Community.

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
Extracting a string from one file and searching the same string in other files mohancrr Shell Programming and Scripting 1 09-19-2007 03:17 AM
searching text files on specific columns for duplicates Gerry405 UNIX for Dummies Questions & Answers 2 08-18-2005 10:51 AM
Searching for data on a specific line numbers rkumar28 Shell Programming and Scripting 8 06-18-2005 12:34 AM
Searching for a specific phrase on Unix server mmcaleer UNIX for Dummies Questions & Answers 1 02-07-2005 04:18 PM
Searching for a specific string in an argumnet dinplant Shell Programming and Scripting 1 03-11-2002 03:28 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 01-05-2006
manthasirisha manthasirisha is offline
Registered User
  
 

Join Date: Jan 2006
Posts: 59
Question grep - searching for a specific string

ppl,

this is my "file" with fields

orderno orderdate orderdesc telno street city
1 01/04/2006 abc 123 100 tampa
2 01/04/2006 abc 123 100 tampa
3 01/04/2006 abc 123 100 tampa
4 01/04/2006 abc 123 100 tampa
5 01/04/2006 abc 123 100 tampa
6 01/04/2006 abc 123 100 tampa

searching for lines with ordernos 3,4 and 5 in a loop as:

ll=3
ul=5

while [ $ll -le $ul ]
do
grep '^$ll\>' file
ll=$((ll+1))
done

gives me null output.

pls help with the correct expression to retrieve the required lines. UNDERLINE.. the key to search is only the first field.. all other fields are same and can't be used. (p.s. however the expression is working with substituted values of $ll (if i hard code $ll with 3, 4 or 5.. i get correct results)

Thanks a lot in advance,
Sirisha
 

Bookmarks

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 10:00 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