Sponsored Content
Top Forums Shell Programming and Scripting number of lines returned from a grep command Post 302245266 by vidyadhar85 on Thursday 9th of October 2008 05:12:36 PM
Old 10-09-2008
use grep -c option
 

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

Copying file names returned from a grep command into another directory

When I do the following : grep -l "string" *, I get a list of file names returned. Is there a way to copy the files returned from the list into another directory ?. Thanks. (4 Replies)
Discussion started by: Kartheg
4 Replies

2. Shell Programming and Scripting

recording lines returned from fgrep...

Ok, I'm too used to c/java. I want to go through a file to search for lines matching a given string using: fgrep "matchString" anyfile.dat; This works like it should, but I would like to record the lines in an array, rather than echo them. Any ideas? :eek: Thanks. P.S. I'm using ksh. (3 Replies)
Discussion started by: DrRo183
3 Replies

3. IP Networking

Port number of socket returned by accept()

Hi, I typed a few tcp/ip client/server examples from a book and it works - sort of - but I noticed something strange. When I run my server I set it to use port 3001 and the client uses the same port to connect to server. They succeed, but the server prints something that doesn't really make much... (0 Replies)
Discussion started by: idelovski
0 Replies

4. Shell Programming and Scripting

downsizing of strings which are returned by grep

hey every1, i am a very new shell programmer. what i am trying to do is to rename a music file using its metadata(using mminfo) the problem is, mminfo's output is very weird: my final filename should be "$artist - $title" however, when i use artist=` mminfo ~/Desktop/It\'s\ Not\ My\... (16 Replies)
Discussion started by: abhigyan91
16 Replies

5. Shell Programming and Scripting

Extracting a certain number with grep command

Hello Friends, when I type grep '275' myfile.txt it gives me all the lines including 275 but it also gives others such as 0.8827588 or 1127507. I only want the lines including 275. How can I extract only 275 without other numbers including 275. thanks (2 Replies)
Discussion started by: rpf
2 Replies

6. Shell Programming and Scripting

Grep range of lines to print a line number on match

Hi Guru's, I am trying to grep a range of line numbers (based on match) and then look for another match which starts with a special character '$' and print the line number. I have the below code but it is actually printing the line number counting starting from the first line of the range i am... (15 Replies)
Discussion started by: Kevin Tivoli
15 Replies

7. Shell Programming and Scripting

Grep lines for number greater than given number

Hello, I am newbie to bash scripting. Could someone help me with the following. I have log file with output as shown below **************************LOG************************* 11/20/2013 9:11:23.64 Pinging xx.xx.xx.xx with 32 bytes of data: 11/20/2013 9:11:23.64 Reply from xx.xx.xx.xx:... (4 Replies)
Discussion started by: meena_2013
4 Replies

8. Shell Programming and Scripting

How to print N number of lines before and after the grep?

Hi , My record file , need to print up to above (DATA array)(there may be n no lines ) , grep "myvalue" row now .....suggest me some options --- DATA Array--- record type xxxxx sequence type yyyyy 2 3---> data1 /dev/ --- DEVICE --- MAXIMUM_People= data_blocks= MY_value=2 xyz abc ... (0 Replies)
Discussion started by: Huvan
0 Replies

9. UNIX for Beginners Questions & Answers

How to output non-number lines with grep?

I want to check my data quality. I want to output the lines with non-number. I used the grep command: grep '' myfile.csv Since my file is csv file, I don't want to output the lines with comma. And I also don't want to output "." or space. But I still get the lines like the following:... (8 Replies)
Discussion started by: twotwo
8 Replies

10. UNIX for Beginners Questions & Answers

Grep command to show the number of results

Hi I wanted to know if there is an option in grep command to show the number of results (not the number of lines of findings). Thanks (14 Replies)
Discussion started by: abdossamad2003
14 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)
All times are GMT -4. The time now is 12:31 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy