Sponsored Content
Full Discussion: grep for a special range
Top Forums Shell Programming and Scripting grep for a special range Post 302368723 by danmero on Thursday 5th of November 2009 12:27:32 PM
Old 11-05-2009
Quote:
Originally Posted by Timmää
grep '^.\{8\}mueller02' file1 + grep '^.\{17\}test' file1
You don't need to grep twice
Code:
grep '^.\{8\}mueller02test' file

or for second test as pattern
Code:
grep '^.\{8\}mueller02.\{4\}test' file



---------- Post updated at 12:27 PM ---------- Previous update was at 12:27 PM ----------

To keep the forums high quality for all users, please take the time to format your posts correctly.
  1. Use Code Tags when you post any code or data samples so others can easily read your code.
    You can easily do this by highlighting your code and then clicking on the # in the editing menu. (You can also type code tags [code] and [/code] by hand.)
  2. Avoid adding color or different fonts and font size to your posts.
    Selective use of color to highlight a single word or phrase can be useful at times, but using color, in general, makes the forums harder to read, especially bright colors like red.
  3. Be careful when you cut-and-paste, edit any odd characters and make sure all links are working property.

Thank You.

The UNIX and Linux Forums
Reply With Quote
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

grep numbers range

I want to grep a range of numbers in a log file. My log file looks like this: 20050807070609Z;blah blah That is a combination of yr,month,date,hours,minutes,seconds. I want to search in the log file events that happened between a particular time. like between 20050807070000 to 20050822070000... (1 Reply)
Discussion started by: azmathshaikh
1 Replies

2. Shell Programming and Scripting

How to keep(or grep) range of line ?

I have simple text log file look like that ----------------------------------------- Mon May 8 07:02:41 2006 Some text to show log Mon May 8 07:05:30 2006 Some text to show log Some text to show log Mon May 8 07:11:07 2006 Some text to show log Mon May 8 07:45:56 2006 Some text to... (1 Reply)
Discussion started by: aungomarin
1 Replies

3. UNIX for Dummies Questions & Answers

Using grep on a range of numbers

Hi im new to unix and need to find a way to grep the top 5 numbers in a file and put them into another file. For example my file looks like this abcdef 50000 abcdef 45000 abcdef 40000 abcdef 35000 abcdef 30000 abcdef 25000 abcdef 20000 abcdef 15000 abcdef 10000 and so on... How can... (1 Reply)
Discussion started by: ProgChick2oo9
1 Replies

4. Shell Programming and Scripting

How to print range of lines using sed when pattern has special character "["

Hi, My input has much more lines, but few of them are below pin(IDF) { direction : input; drc_pinsigtype : signal; pin(SELDIV6) { direction : input; drc_pinsigtype : ... (3 Replies)
Discussion started by: nehashine
3 Replies

5. Shell Programming and Scripting

grep for a range of numbers

Dear Friends, I want to know how to grep for the lines that has a number between given range(start and end). I have tried the following sed command. sed -n -e '/20030101011442/,/20030101035519/p' However this requires both start and end to be part of the content being grepped. However... (4 Replies)
Discussion started by: tamil.pamaran
4 Replies

6. UNIX Desktop Questions & Answers

grep a range of text

hey, i need to grep / awk a list of "DEV ID" range for example for greping 0936 - 09C1 from this file: 0x5000097310036d05 558 1 20531 LOCAL GLOBAL 42048000 YES 0x8e36c8bd07ce9e13 DEV ID: 0933 0x5000097310036d05 559 1 20531 ... (1 Reply)
Discussion started by: boaz733
1 Replies

7. Shell Programming and Scripting

Grep ip range

I want to find all files under /var directory that refer to any ip from 10.1.1.1 to 10.1.1.255 using grep. How can this be done. Please help (5 Replies)
Discussion started by: proactiveaditya
5 Replies

8. UNIX for Dummies Questions & Answers

grep only from a range of columns

Hello all, I have a .csv file with over 100 columns. I would like to grep for a pattern only searching within a range of those fields, and print the entire line. For example: grep a pattern from columns $47-$87, but print fields $0 - $100 Thanks! (9 Replies)
Discussion started by: torchij
9 Replies

9. UNIX for Dummies Questions & Answers

Grep for a range of numbers?

I am trying to extract specific information from a large *.sam file (it's originally 28Gb). I want to extract all lines that are on chr3 somewhere in the range of 112,937,439-113,437,438. Here is a sample line from my file so you can get a feel for what each line looks like: seq.4 0 ... (8 Replies)
Discussion started by: genGirl23
8 Replies

10. Shell Programming and Scripting

Unable to identify the special characters beyond the range of "[\x80-\xFF]"

I want to filter out the special character whose ascii value doesn't fall within the range "" . Example:� or Ć. So in that case is there any defined range which will filter out this characters. I can filter those which falls withing "" . Need to filter those special chracter which doesn't... (14 Replies)
Discussion started by: Abhijit Sen
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 05:50 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy