07-26-2008
learning about pipes!
im trying to figure out how to do the following:
using pipes to combine grep and find commands to print all lines in files that start with the letter f in the current directory that contain the word "test" for example?
again using pipes to combine grep and find command, how can I print all the file names starting with f whose names also contain the word "test", again in the current directory?
combining grep and cat commands , i need the print the number of lines in "testa.txt" and "testb.txt" that contain the string hello.c
combining tail and grep commands, if the string "pipes" is in the last 5 lines of a test.txt file, then i want to print the lines it is in.
combing head, tail, grep commands, if the string "pipes" is in lines 10-14 of file test.txt, the print the lines it is in.
thanks for any help!
10 More Discussions You Might Find Interesting
1. Filesystems, Disks and Memory
Hello!
How I can increase or decrease predefined pipe buffer size?
System FreeBSD 4.9 and RedHat Linux 9.0
Thanks! (1 Reply)
Discussion started by: Jus
1 Replies
2. Shell Programming and Scripting
Hi,
Can the cd command be invoked using pipes???
My actual question is slightly different. I am trying to run an executable from different folders and the path of these folders are obtained dynamically from the front end. Is there a way in which i can actually run the executable... (2 Replies)
Discussion started by: Sinbad
2 Replies
3. Programming
heya
got a small problem here. im trying to pipe eg: 'ls | more'.
i have created a command line parser which separates ls and more into two commands. i have also created a struct, each struct has a command name, number of arguments, redirect_in, redirect_out, pipe_in, etc etc.... eg:
struct... (0 Replies)
Discussion started by: mile1982
0 Replies
4. UNIX for Dummies Questions & Answers
What is the difference between:
cd /tmp
tar -cf - *.txt |gzip > tmp_txt.tar.gz
and
cd /tmp
mknod pipe p
gzip < pipe > /tmp/tmp_txt1.tar.gz &
tar -cf pipe *.txt
Apart from the fact that we have to create the pipe file manually, is there any difference in the performance of the two?... (5 Replies)
Discussion started by: blowtorch
5 Replies
5. UNIX for Advanced & Expert Users
Hi...Can anyone please guide me on FIFO Pipes in UNIX.I have lerant things like creating fifo pipes,using them for reads and writes etc.I want to know what is the maximum amount of memory that such a pipe may have? Also can anyone guide me on where to get info on this topic from? (4 Replies)
Discussion started by: tej.buch
4 Replies
6. UNIX for Advanced & Expert Users
This is something I've given a lot of thought to and come up with no answer.
Say you have a data stream passing from a file, through process A, into process B. Process A only modifies a few bytes of the stream, then prints the rest of the stream unmodified. Is there any way to stream the file... (4 Replies)
Discussion started by: Corona688
4 Replies
7. Shell Programming and Scripting
I have to add pipes for particualr number of records in a file. For eg the file has 10 records and i need to add the "|" for records numbers 7 to 10 at particular positons as shown.
I need to add pipes in each of these records at positions 9, 11,,21 as like below.
Can some body... (7 Replies)
Discussion started by: dsravan
7 Replies
8. Shell Programming and Scripting
Hi,
thanks for b4. can anyone tell me why following not working:
noUsers=$(who | cut -d" " -f1 | wc -l)
What i'm trying to do is get a list of logged on users and pass it to 'wc -l' and store the output to a variable. Any ideas? (1 Reply)
Discussion started by: Furqan_79
1 Replies
9. Programming
Hello all, I am trying to learn more about programming Unix pipes in C.
I have created a pipe that does od -bc < myfile | head
Now, I am trying to create od -bc < myfile | head | wc
Here is my code, and I know I might be off, thats why I am here so I can get some clarification.
#include... (1 Reply)
Discussion started by: petrca
1 Replies
10. Shell Programming and Scripting
Hi,
I'm trying avoid having a large number of 'if' statements in my script by setting up a variable within 'ksh' which can be expanded depending on parameters passed to the script. The output from the 'cat' command should be able pipe its output into any additional commands on the command line... (4 Replies)
Discussion started by: stv_t
4 Replies
ZGREP(1) General Commands Manual ZGREP(1)
NAME
zgrep - search possibly compressed files for a regular expression
SYNOPSIS
zgrep [ grep_options ] [ -e ] pattern filename...
DESCRIPTION
Zgrep invokes grep on compressed or gzipped files. These grep options will cause zgrep to terminate with an error code:
(-[drRzZ]|--di*|--exc*|--inc*|--rec*|--nu*). All other options specified are passed directly to grep. If no file is specified, then the
standard input is decompressed if necessary and fed to grep. Otherwise the given files are uncompressed if necessary and fed to grep.
If the GREP environment variable is set, zgrep uses it as the grep program to be invoked.
EXIT CODE
2 - An option that is not supported was specified.
AUTHOR
Charles Levert (charles@comm.polymtl.ca)
SEE ALSO
grep(1), gzexe(1), gzip(1), zdiff(1), zforce(1), zmore(1), znew(1)
ZGREP(1)