Extract multiple occurance of strings between 2 patterns
I need to extract multiple occurance strings between 2 different patterns in given line.
For e.g. in below as input
-------------------------------------------------------------------------------------
-------------------------------------------------------------------------------------
I need output to be
-------------------------------------------------------------------------------------
-------------------------------------------------------------------------------------
condition 1 : Extract output between paranthesis.
condition 2 : number of patterns match is unknown.
I tried below command using awk, but it extracts only first pattern match.
Last edited by Don Cragun; 10-24-2013 at 07:47 AM..
Reason: Add CODE tags.
Hi
I have the following requirement. i have the following line from a log file
one : two : Three : four : five : six : seven : eight :nine :ten
Now can you pls help what i should do to get only the following output from the above line
two : five : six : seven : Eight
appreciate your... (3 Replies)
How to grep multiple string occurance in input file using single grep command? I have below input file with many IDP, RRBE messages. Out put should have count of each messages.
I have used below command but it is not working
grep -cH "(sent IDP Request)(Recv RRBCSM)" *.txt ... (5 Replies)
hi ,
i have an xml that comes in a single, the entire xml file is read as a single line when i open in edit plus or unix. i need to amend the contents of this xml file.
below is the extract from the file
<rpc-reply xmlns="urn:ietf:params:xml:ns:netconf:base:1.0"... (5 Replies)
input file
Desired csv output
gc_type, date/time, milli secs
af, Mar 17 13:09:04 2011, 144.596
af, Mar 20 00:37:37 2011, 144.242
af, ar 20 21:30:59 2011, 108.518
Hi All,
Any help in acheiving the above would be appreciated. I would like to parse through lines within one file and... (5 Replies)
Hi all,
Please go through my requirement.
I have a log file in the location /opt/WebSphere61/AppServer/profiles/EMQbatchprofile/logs/EMQbatch
This file contains the follwing pattern data
<af type="tenured" id="42" timestamp="May 14 13:44:13 2011" intervalms="955.624">
<minimum... (8 Replies)
I am trying to extract multiple strings from snmp-mib files like below.
-----
$ cat IF-MIB.mib
<snip>
linkDown NOTIFICATION-TYPE
OBJECTS { ifIndex, ifAdminStatus, ifOperStatus }
STATUS current
DESCRIPTION
"A linkDown trap signifies that the SNMP entity, acting in... (5 Replies)
Hi,
I wasn't quite sure how to title this one! Here goes:
I have some already partially parsed log files, which I now need to extract info from. Because of the way they are originally and the fact they have been partially processed already, I can't make any assumptions on the number of... (8 Replies)
Hello
I have an output that has a string between quotes and another between square brackets on the same line. I need to extract these 2 strings Example line
Device "nrst3a" attributes=(0x4) RAW SERIAL_NUMBER=SNL2
Output should look like
nrst3a VD073AV1443BVW00083
I was trying with sed... (3 Replies)
Hi All,
From the below file. I need to get only the first occurrence and print. I tried to do it in separate grep not coming as expected
Original file
11001;1213;304;;;;;;;111020677.64;;;;;;;;;;;;;;;;;;;;;;;;;;
11001;1214;304;;;;;;;102376462.96;;;;;;;;;;;;;;;;;;;;;;;;;;... (5 Replies)
Hi,
I need help to match patterns from between two different files and extract region of strings.
inputfile1.fa
>l-WR24-1:1
GCCGGCGTCGCGGTTGCTCGCGCTCTGGGCGCTGGCGGCTGTGGCTCTACCCGGCTCCGG
GGCGGAGGGCGACGGCGGGTGGTGAGCGGCCCGGGAGGGGCCGGGCGGTGGGGTCACGTG... (4 Replies)
Discussion started by: bunny_merah19
4 Replies
LEARN ABOUT OSF1
strextract
strextract(1) General Commands Manual strextract(1)NAME
strextract - batch string extraction
SYNOPSIS
strextract [-p patternfile] [-i ignorefile] [-d] [source-program...]
OPTIONS
Ignore text strings specified in ignorefile. By default, the strextract command searches for ignorefile in the current working directory,
your home directory, and /usr/lib/nls.
If you omit the -i option, strextract recognizes all strings specified in the patterns file. Use patternfile to match strings in
the input source program. By default, the command searches for the pattern file in the current working directory, your home direc-
tory, and finally /usr/lib/nls.
If you omit the -p option, the strextract command uses a default patterns file that is stored in /usr/lib/nls/patterns. Disables
warnings of duplicate strings. If you omit the -d option, strextract prints warnings of duplicate strings in your source program.
DESCRIPTION
The strextract command extracts text strings from source programs. This command also writes the string it extracts to a message text file.
The message text file contains the text for each message extracted from your input source program. The strextract command names the file by
appending to the name of the input source program.
In the source-program argument, you name one or more source programs from which you want messages extracted. The strextract command does
not extract messages from source programs included using the #include directive. Therefore, you might want a source program and all the
source programs it includes on a single strextract command line.
You can create a patterns file (as specified by patternfile ) to control how the strextract command extracts text. The patterns file is
divided into several sections, each of which is identified by a keyword. The keyword must start at the beginning of a new line, and its
first character must be a dollar sign ($). Following the identifier, you specify a number of patterns. Each pattern begins on a new line
and follows the regular expression syntax you use in the regexp(3) routine. For more information on the patterns file, see the patterns(4)
reference page.
In addition to the patterns file, you can create a file that indicates strings that extract ignores. Each line in this ignore file con-
tains a single string to be ignored that follows the syntax of the regexp(3) routine.
When you invoke the strextract command, it reads the patterns file and the file that contains strings it ignores. You can specify a pat-
terns file and an ignore file on the strextract command line. Otherwise, the strextract command matches all strings and uses the default
patterns file.
If strextract finds strings which match the ERROR directive in the pattern file, it reports the strings to standard error (stderr.) but
does not write the string to the message file.
After running strextract, you can edit the message text file to remove text strings which do not need translating before running strmerge.
It is recommended that you use extract command as a visual front end to the strextract command rather than running strextract directly.
RESTRICTIONS
Given the default pattern file, you cannot cause strextract to ignore strings in comments that are longer than one line.
You can specify only one rewrite string for all classes of pattern matches.
The strextract command does not extract strings from files include with #include directive. You must run the strextract commands on these
files separately.
% strextract -p c_patterns prog.c prog2.c % vi prog.str % strmerge -p c_patterns prog.c prog2.c % gencat prog.cat prog.msg prog2.msg % vi
nl_prog.c % vi nl_prog2.c % cc nl_prog.c nl_prog2.c
In this example, the strextract command uses the c_patterns file to determine which strings to match. The input source programs are named
prog.c and prog2.c.
If you need to remove any of the messages or extract one of the created strings, edit the resulting message file, prog.str. Under no condi-
tions should you add to this file. Doing so could result in unpredictable behavior.
You issue the strmerge command to replace the extracted strings with calls to the message catalog. In response to this command, strmerge,
creates the source message catalogs, prog.msg and prog2.msg, and the output source programs, nl_prog.c and nl_prog2.c.
You must edit nl_prog.c and nl_prog2.c to include the appropriate catopen and catclose function calls.
The gencat command creates a message catalog and the cc command creates an executable program.
SEE ALSO gencat(1), extract(1), strmerge(1), regexp(3), catopen(3), patterns(4)
Writing Software for the International Market
strextract(1)