Sponsored Content
Full Discussion: Grep from multiple files
Top Forums UNIX for Dummies Questions & Answers Grep from multiple files Post 302315886 by robertson1995 on Wednesday 13th of May 2009 12:18:37 PM
Old 05-13-2009
Grep from multiple files

Hello,

How do I grep from multiple, specific file names. For example I have a directory that has numerous files named bsm0a.alarm_output.xxxxxx (the x's will be the date).

I need to be able to grep any string that contains the acronym ACN or the word packets, but I will only need them from specific files. For example, I need to be able to grep from bsm0a.alarm_output.051009, bsm0a.alarm_output.051109 & bsm0a.alarm_output.051109 and nothing else.

Thanks.
 

10 More Discussions You Might Find Interesting

1. UNIX for Advanced & Expert Users

grep count across multiple files

I have a number of simulation log files and I want to get a total count of the "PASSED" expression in them. If I use grep -c <files>, grep would give a tally for each file. I just want one number, the total count. How do I do that? (4 Replies)
Discussion started by: CrunchMunch
4 Replies

2. UNIX for Dummies Questions & Answers

Grep from multiple files

Hello, I need to grep from multiple files that begin with the same text. For example, I have files named alert_audit324, alert_audit325, alert_audit326, etc. Is there a way I can use a wildcard and grep from any file that begins with alert_audit? Thanks. (1 Reply)
Discussion started by: robertson1995
1 Replies

3. Shell Programming and Scripting

Grep in subdir, multiple files

Hi, I m trying to have script to grep a pattern in all files under a directory. I use Sun Solaris, the below want doesnt do exactly what I want. find /home/xxx/ tagHeu | while read FILE; do grep text $FILE && echo 1 grep text $FILE || echo 0 done I also tried running: find... (2 Replies)
Discussion started by: s3rro
2 Replies

4. UNIX for Dummies Questions & Answers

Grep multiple strings in multiple files using single command

Hi, I will use below command for grep single string ("osuser" is search string) ex: find . -type f | xarg grep -il osuser but i have one more string "v$session" here i want to grep in which file these two strings are present. any help is appreciated, Thanks in advance. Gagan (2 Replies)
Discussion started by: gagan4599
2 Replies

5. Shell Programming and Scripting

grep from multiple lines in several gz files

Hello all, I have been struggling to get grep work to my requirements. Basically I have to filter out patterns spread across multiple lines over hundreds of .gz files in a folder. And the output needs to be piped to a file. Here is the example: folder name: logs files in this folder:... (4 Replies)
Discussion started by: mandhan
4 Replies

6. UNIX Desktop Questions & Answers

How do you [e]grep for multiple values within multiple files?

Hi I'm sure there's a way to do this, but I ran out of caffeine/talent before getting the answer in a long winded alternate way (don't ask ;) ) The task I was trying to do was scan a directory of files and show only files that contained 3 values: I940 5433309 2181 I tried many variations... (4 Replies)
Discussion started by: callumw
4 Replies

7. Shell Programming and Scripting

Grep multiple strings in multiple files

Hi, every one! I have a file with multiple strings. file1 ATQRGNE ASQGVKFTE ASSQYRDRGGLET SPEQGARSDE ASSRDFTDT ASSYSGGYE ASSYTRLWNTGE ASQGHNTD PSLGGGNQPQH SLDRDSYNEQF I want to grep each string in hundreds of files in the same directory, further, I want to find out the string... (7 Replies)
Discussion started by: xshang
7 Replies

8. UNIX for Dummies Questions & Answers

Grep from multiple files by column name

I have 40 files with varying number of columns They however do have identical column names for the overlapping columns I would like to grep some info from these specific colums e.g file1 id beta se direction N 2 .5 .01 + 1000 5 -.6 .02 - 2000 file2 id ... (6 Replies)
Discussion started by: MFAB
6 Replies

9. Shell Programming and Scripting

Grep multiple files

Hello, I am trying to grep, in bash, multiple specific files at once. I understand you can grep parameters file1 file2... fileN. My question is how to do this when the specific files are not constant in name or quantity? (min 2 files, max 24 files) Example 1: grep parameters file1 file2... (3 Replies)
Discussion started by: speedy1354
3 Replies

10. Shell Programming and Scripting

Grep strings on multiple files and output to multiple files

Hi All, I want to use egrep on multiple files and the results should be output to multiple files. I am using the below code in my shell script(working in Ksh shell). However with this code I am not attaining the desired results. #!/bin/ksh ( a="/path/file1" b="path/file2" for file in... (4 Replies)
Discussion started by: am24
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)
All times are GMT -4. The time now is 04:55 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy