Sponsored Content
Top Forums UNIX for Dummies Questions & Answers Your favorite command and mine - grep Post 95048 by zazzybob on Friday 6th of January 2006 12:32:05 AM
Old 01-06-2006
Code:
$ cat wxornot
BCX 3 5
BCX 23 94
BNG 34 34
BCX 2 09
$ while read line; do
>   echo "${line}" | grep BCX && break
> done < wxornot
BCX 3 5

If you want to assign a value to a variable, then
$ FOO="BCX"
then change the grep to
... | grep "${FOO}" && break

Cheers
ZB
 

4 More Discussions You Might Find Interesting

1. What is on Your Mind?

What's your favorite Xscreensaver?

Out of the 100s of screensavers in xscreensaver, what is your favorite? I think mine is definitely juggle. I can sit and watch that juggler forever. I haven't looked into the code, but it must be amazingly complex to deal with all that's going on. From the random throwing pattern, to the arm... (0 Replies)
Discussion started by: tjlst15
0 Replies

2. What is on Your Mind?

Where Is Your Favorite Continent?

Where is your favorite continent to enjoy life? (14 Replies)
Discussion started by: Neo
14 Replies

3. Fedora

od -c . does not work on mine

# od -c . od: .: read error: Is a directory 0000000 I read the book about shell (Kernighan, Pike) and some exaples (like this) does not work. I read this book carefully (because I think now quickly) even reread to better understand. In this book there is a good example how to see what a... (2 Replies)
Discussion started by: Xcislav
2 Replies

4. What is on Your Mind?

What are Your Favorite Chips? Mine are Doritos Nacho Cheesier!

By far, Doritos Nacho Cheesier are the best tasting chips, well at least too me. Have you tried them? What are your favorite chips? (5 Replies)
Discussion started by: Neo
5 Replies
XZGREP(1)							     XZ Utils								 XZGREP(1)

NAME
xzgrep - search compressed files for a regular expression SYNOPSIS
xzgrep [grep_options] [-e] pattern file... xzegrep ... xzfgrep ... lzgrep ... lzegrep ... lzfgrep ... DESCRIPTION
xzgrep invokes grep(1) on files which may be either uncompressed or compressed with xz(1), lzma(1), gzip(1), or bzip2(1). All options specified are passed directly to grep(1). If no file is specified, then standard input is decompressed if necessary and fed to grep(1). When reading from standard input, gzip(1) and bzip2(1) compressed files are not supported. If xzgrep is invoked as xzegrep or xzfgrep then egrep(1) or fgrep(1) is used instead of grep(1). The same applies to names lzgrep, lze- grep, and lzfgrep, which are provided for backward compatibility with LZMA Utils. ENVIRONMENT
GREP If the GREP environment variable is set, xzgrep uses it instead of grep(1), egrep(1), or fgrep(1). SEE ALSO
grep(1), xz(1), gzip(1), bzip2(1), zgrep(1) Tukaani 2010-09-27 XZGREP(1)
All times are GMT -4. The time now is 06:30 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy