![]() |
|
|
google unix.com
|
|||||||
| Forums | Register | Forum Rules | Links | Albums | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
| 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 |
| after grep i want to redirect it to some variable | mail2sant | Shell Programming and Scripting | 2 | 04-07-2008 10:26 AM |
| grep for a variable problem | MizzGail | UNIX for Dummies Questions & Answers | 7 | 03-01-2006 04:09 PM |
| setting variable from grep | cut | doublejz | Shell Programming and Scripting | 1 | 08-24-2005 04:39 PM |
| grep embedded in a variable | Nicol | Shell Programming and Scripting | 6 | 04-14-2005 05:44 AM |
| How to grep a variable? | whatisthis | Shell Programming and Scripting | 2 | 09-14-2004 07:26 PM |
![]() |
|
|
LinkBack | Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
||||
|
grep with variable
Hi, I can't get this script to work (returns 0, should return 3): Code:
$ cat A.lst | \
while read LINE
do
echo "$LINE"
grep -c "$LINE" B.tmp
done> > > > >
Socket
0
$
but in contrast this one works fine (returns 3 as expected): Code:
$ LINE=Socket $ grep -c $LINE B.tmp 3 $ Note: A.lst contains one line with a string: Socket B.tmp contains 3 lines with strings: Socket Thank you! |
![]() |
| Bookmarks |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|