Log from a specific line to another specific line

RajuBhai

I am doing a data monitoring and I am doing a cron job to get the data everyday. But I am receiving many junk data with my actual data that makes the file huge. For example my data is,

eg.hh.jk.ll.mm
ee.ff.gg.hh.uh
im.mi.jj.hh.ll
11.33.44.55.66

I have to print the data matching the line from ff.gg to the line matching 33.44. Line number is not available. So my result should be

ee.ff.gg.hh.uh
im.mi.jj.hh.ll
11.33.44.55.66

Thank you !

heemayl

Using sed:

sed -n '/ff\.gg/,/33\.44/p' file.log

The first // matches the starting pattern (line) and the last // matches the ending pattern (line).

Example:

$ cat file.txt                        
14.33.ad.55.66
eg.hh.jk.ll.mm
ee.ff.gg.hh.uh
im.mi.jj.hh.ll
11.33.44.55.66
1f.fs.45.55.66
11.as.56.55.66

$ sed -n '/ff\.gg/,/33\.44/p' file.txt
ee.ff.gg.hh.uh
im.mi.jj.hh.ll
11.33.44.55.66

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

Read file from specific line until another specific line in laravel

How to read a file from a specific line to another specific line?

How to echo from specific line of a file to another specific line

Move specific line from a position to another

Remove specific log line in Android

Read from one line with a specific content till another line with specific content in Lua. How?

How to append a string to one specific line and remove a string from another specific line in a file?

Filter out number from a specific line in log file

How to remove every line starting with specific string from log file?

Substring the line from specific char to specific char

Removing a specific line from a file

Loop PS from specific line

Deleting specific line from file

Removing A Specific Line From A File

set variable from specific line

Get a specific line from a variable

Delete a specific line from a file

Retrieve the commit log for a specific line in a file?

How to delete from specific line until specific line in a file on python

copy line from a txt file and replace it in another txt file at specific number line using PowerShell

Create another symbol in specific point in a line graph

awk return another line when a specific line is equal to something

How to scrape a specific html line that follow another html line

How To Read A File and Look For a Specific Line to Another Line - Java

Cut specific part of line and paste into specific part of another file

Executing command from specific line from a file

How to curl from specific line from website?

Read a specific line from file and separate the data from one line

Get a specific words from a specific line from a text file in NetBSD