It is well past my bed time, so I'm not going to try to come up with a solution to your problem right now, but I will note that your final sed script (if you used double quotes instead of single quotes, as I suggested before) will match:
in addition to matching the otid and dtid strings you want it to match. Since you have only shown us two records from your huge file, I have absolutely no idea how many other records might have this (or other) false matches for the way you're using to find pairs of matched records.
It is also interesting to note that the problem presented in post #1 in this thread is apparently unrelated to the problem presented here. Why the misdirect asking for a match on a tp-da value when what you're really looking for is a shared otid and dtid value filtered by part of a Source Address value? And, what keeps that part of a Source Address field from appearing in some other record's Source Address or Destination Address field? Are you sure the initial value you're looking for doesn't appear in some other field in your file as well?
Once you figure out what the otid value you're looking for is, do you know if the dtid value you need to match comes before or after the record containing the otid value? (If you know it comes after the value you've identified, it sure would be nice to just read your huge file once instead of reading the whole file more than three times.
How big is your "huge" file? Are we talking about megabytes, terabytes, or petabytes? How much memory do you have on your system?
What operating system and shell are you using?
Last edited by Don Cragun; 02-26-2017 at 06:59 AM..
Reason: Fix typos.
You lost me. Are you looking for records containing
- tp-da : 0.1.078394420 and / or SSN: 6 GT: .85290985144?
- And then the otid value from within those to be matched with a dtid value? Or any other field's value?
- What is the sequence of otid / dtid,otid always first? Or last?
- Should otid records be printed regardless of dtid found or not?
- How many pairs will occur in one log file? Are they mixed up or in sequence?
Linux version : Oracle Linux 6.5
Shell : bash
In the the below text file (someString.text), I want to grep all lines with .sh in it. ie. Only the lines mysript.sh and anotherscript.sh should be returned.
My below attempts failed.
I gather that in regular expression world, dot (.) is the... (3 Replies)
Hello,
I am trying to grep search a pattern and a line before it.
cat input
>record1
hello1hello2hellonhello3
>record2
helloohello1hello2hello3
When I use, grep with -o option and either of -A/B/C options, I still can't see lines before or after the pattern. But the exact pattern is... (5 Replies)
The intended result should be :
PDF converters
'empty line'
gpdftext and pdftotext?xml version="1.0"?>
xml:space="preserve"><note-content version="0.1" xmlns:/tomboy/link" xmlns:size="http://beatniksoftware.com/tomboy/size">PDF converters
gpdftext and pdftotext</note-content>... (9 Replies)
Hi all!
Thanks for taking the time to view this!
I want to grep out all lines of a file that starts with pattern 1 but also does not match with the second pattern.
Example:
Drink a soda
Eat a banana
Eat multiple bananas
Drink an apple juice
Eat an apple
Eat multiple apples
I... (8 Replies)
Hi All,
I am trying to fetch lines before a pattern, I got to know about -B flag in grep but we have to pass the number to get those lines before some pattern say (X), now what if I want to get line/s with some other pattern say (Y) before X pattern? How to get about it? please help.
Input:... (5 Replies)
Hi,
I have got the below requirement. please suggest.
I have a file like,
Processing Item is:
/data/ing/cfg2/abc.txt
/data/ing/cfg3/bgc.txt
Processing Item is:
/data/cmd/for2/ght.txt
/data/kernal/config.klgt.txt
I want to process the above file to get the output file like,
... (5 Replies)
Hi all,
I am looking for a quick solution for this:
I have many log files of an iterative program, and I would like to display the parameters of the last three iteration from each of those files. Relevant lines have the keyword: ITER
I am using:
tac ~/modeling*/fitting.log | grep -m 3 -e... (2 Replies)
OK. I have a file I'd like to be able to grep, but on top of returning the line where the pattern matches, I'd like to be able to get the previous 8 lines and the following 8 lines. Is there a way to do this? (2 Replies)
Hi All,
OS-Type=Sun-OS 5.8 Sparc9 Processor
Can I grep the previous 4 lines and next 4 lines of a matched pattern(context grep)?
For example here we need to monitor logs of live traffic.The data obtained from "tail -f LiveTrafficData.log"
looks something like this:-... (3 Replies)