I have some CVS log files, which are divided into blocks. Each block has many fields of information and I want to extract those blocks with a pattern. Here is the sample input.
After the word "description", there is information for each revision. I only want those revisions where the last field (which is free text) has the patterns "Bug" , or "Fix" or "####" some number without any preceding letters or words. The last field may be in a single line or in 2 lines.
The above input has the data for 2 files. For each file, I want to retain the information till the word "description", but after that I want the information only for those revisions which have these patterns in them.
The expected output is
Sorry for the long question. I would appreciate any help.
Thank you very much.
Sandeep
Last edited by sandeepk1611; 02-14-2011 at 06:00 PM..
Reason: wrong output
Just a couple of slight tweaks to stop false positives (Bug Fix must start 3rd line) and also support number without proceeding letters (think that is what ##### was supposed to represent):
This User Gave Thanks to Chubler_XL For This Post:
A couple of things to keep in mind, in case the solutions don't work for the OP:
1. The use of a regular expression or string in RS is a gawk extension.
2. Since at least one field is free text, it's probably a good idea to anchor the FS regular expression.
A couple of things to keep in mind, in case the solutions don't work for the OP:
1. The use of a regular expression or string in RS is a gawk extension.
2. Since at least one field is free text, it's probably a good idea to anchor the FS regular expression.
Regards,
Alister
Agreed, this should anchor things down, and also keeps the =======* and -----* delimiters from the original file.
Hello.
Here is a file contents :
declare -Ax NEW_FORCE_IGNORE_ARRAY=(="§" ="§" ="§" ="§" ="§" .................. ="§"Here is a pattern
=I want to extract 'NEW_FORCE_IGNORE_ARRAY' which is the whole word before the first occurrence of pattern '='
Is there a better solution than mine :... (3 Replies)
Hi,
Could you please help me finding a way to replace a specific value in a text block when matching a key pattern ?
I got the keys and the values from a command similar to:
echo -e "key01 Nvalue01-1 Nvalue01-2 Nvalue01-3\nkey02 Nvalue02-1 Nvalue02-2 Nvalue02-3 \nkey03 Nvalue03-1... (2 Replies)
I am trying to use awk to extract and print the first ocurrence of NM_ and NP_ with a : before in each line. The input file is tab-delimeted, but the output does not need to be. The below does execute but prints all the lines in the file not just the patterns. Thank you :).
file tab-delimeted
... (2 Replies)
Hi ,
I have a file where i have modifed certain things compared to original file . The difference of the original file and modified file is as follows.
# diff mir_lex.c.modified mir_lex.c.orig
3209c3209
< if(yy_current_buffer -> yy_is_our_buffer == 0) {
---
>... (5 Replies)
I have hundreds of files to process. In each file
I need to look for a pattern then
extract value(s) from next line and then
search for value(s) selected from point (2) in the same file at a specific position.
HEADER ELECTRON TRANSPORT 18-MAR-98 1A7V
TITLE CYTOCHROME... (7 Replies)
This is my first post, please be nice. I have tried to google and read different tutorials.
The task at hand is:
Input file input.txt (example)
abc123defhij-E-1234jslo
456ujs-W-abXjklp
From this file the task is to grep the -E- and -W- strings that are unique and write a new file... (5 Replies)
Hi
I have a pattern like :
SYSTEM_NAME-232-S7-200810060949.LOG
Here I need to extract system name and the timestamp and also the numeric number after "-S" i.e 7 here .
I am not very sure of whether I should use sed / awk for this ?:confused:
Thanks,
Priya. (6 Replies)
Hello ,
I need your help to extract a line in a big file , and this line is always 11 lines
before a specific pattern . Do you know a way via Awk ?
Thanks in advance
npn35 (17 Replies)
Hello All,
can anyone help me out in extracting the pattern from a file...
The Input file is:
NFS B.11.11 ONC/NFS; Network-FileSystem,InformationServices,Utilities|123
NParProvider B.11.11.01.04.01.01 nPartition Provider|456
NPartition A.01.02 Enhanced NPartition Commands/789... (6 Replies)