Sponsored Content
Full Discussion: script to grep number
Operating Systems Linux script to grep number Post 302488373 by Ygor on Monday 17th of January 2011 02:21:55 AM
Old 01-17-2011
Try...
Code:
grep '[0-9][0-9] [0-9][0-9] [0-9][0-9] [0-9][0-9] [0-9][0-9] [0-9][0-9]' *.rep

 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

How to grep a number in a file name

Hi, I have multiple files where it starts with test1.c, test2.c,test3.c and so on. I would like to get each file separately to perform abstraction from these files. I tried something like:- for t in ./* filenumber=${t:4} # to cut the "test" in order to get the number cat... (3 Replies)
Discussion started by: ahjiefreak
3 Replies

2. UNIX for Dummies Questions & Answers

using Grep for only a certain number of columns

I am given a file with a list of names for the first 20 characters. The 20 characters after is a list of names that somebody is supposed to team up with. Now i'm trying to write a simple script that will read a name somebody inputs and then looks only in the first 20 characters. For example.... (2 Replies)
Discussion started by: MaestroRage
2 Replies

3. UNIX for Dummies Questions & Answers

grep the number of first occurence

File1.txt ....... ....... OMC LA OMC LK OMC LS ........ ........ Above is the content of File1.txt, i want to get the Number of Occurence to order, lets say if OMC LA = 1, OMC LS=3, and OMC LK=2.. omc_ident="OMC LA" or "OMC LK" or "OMC LS" omc_num=`grep '^OMC' File1.txt| grep... (4 Replies)
Discussion started by: neruppu
4 Replies

4. Shell Programming and Scripting

Grep for a negative number

Hi, I want to search for a return code of -3. Using grep "-3" *.* is giving a syntax error. Please suggest as to how can we search for this pattern using grep. Thanks, Krishna (2 Replies)
Discussion started by: kzmatam
2 Replies

5. UNIX for Dummies Questions & Answers

Grep by column number

I have a data file that is arranged like this: Marketing Ranjit Singh Eagles Dean Johnson FULL Marketing Ken Whillans Eagles Karen Thompson FULL Sales Peter RobertsonGolden TigersRich Gardener PART President Sandeep Jain Wimps Ken Whillans CONT... (7 Replies)
Discussion started by: hitman247m
7 Replies

6. Shell Programming and Scripting

grep the number of self process

Dear All, I plan to write a script and in the beginning, I will check if there's any existing previous process running, if YEs, then exit directly, if Not, then continue. #!/bin/bash NUM=`ps -ef | grep $0 | grep -v grep | wc -l` ps -ef | grep $0 | grep -v grep echo "NUM ==> $NUM" if... (6 Replies)
Discussion started by: tiger2000
6 Replies

7. UNIX for Dummies Questions & Answers

grep any number of spaces

which one of the following is the correct expression to ignore line with multiple spaces after any string cat file | grep -v "xyz *$" or cat file | grep -v "xyz*$" do i need "*" to specify the sapce or " *" will do? (2 Replies)
Discussion started by: manishma71
2 Replies

8. Shell Programming and Scripting

grep number and sent out e-mail

ps -ef |grep /usr/sbin/qdaemon root 5034194 385266 0 Oct 26 - 1:57 /usr/sbin/qdaemon root 7639132 2523220 0 15:25:58 pts/10 0:00 grep /usr/sbin/qdaemon ps -ef |grep /usr/sbin/qdaemon |wc 2 18 145 I need to send out e-mail if the count of the lines... (9 Replies)
Discussion started by: Daniel Gate
9 Replies

9. Shell Programming and Scripting

Grep for a Number in a String

Hi, I have variable called fname that has the value M201401151630_P008949.csv.txt I need to grep and store this in a variable called prcid for the number before ".csv" and the letter "P" excluding all zeros in the beginning. Desired output 8949 Likewise for M201401151630_P108949.csv.txt... (12 Replies)
Discussion started by: mohtashims
12 Replies

10. 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
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 08:10 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy