Hi,
I know how to use awk to search some expressions like five consecutive numbers, , this is easy.
However, how do I make awk print the pattern that is been matched?
For example:
input: usa,canada99292,japan222,france59664,egypt223
output:99292,59664 (6 Replies)
Hi all,
I am trying to extract the values ( text between the xml tags) based on the Order Number.
here is the sample input
<?xml version="1.0" encoding="UTF-8"?>
<NJCustomer>
<Header>
<MessageIdentifier>Y504173382</MessageIdentifier>
... (13 Replies)
Hi,
I am writing a shell script to parse some files, and gather data.
The data in the files is displayed as below.
.......xyz: abz: ......qrt: ....
.......xyz: abz: ......qrt: ...
I have tried using awk and cut, but the position of these values keep changing, so I wasn't able to get... (2 Replies)
Hi,
I am writing a shell script to parse some files, and gather data.
The data in the files is displayed as below.
.......xyz: abz: ......
.......xyz: abz: .....
I have tried using awk and cut, bu the position of these values keep changing, so I can use awk and split it into columns. ... (14 Replies)
Hi experts , im new to Unix,AWK ,and im just not able to get this right.
I need to match for some patterns if it matches I need to print the next few words to it.. I have only three such conditions to match… But I need to print only those words that comes after satisfying the first condition..... (2 Replies)
I have
2013-06-11 23:55:14 1Umexd-0004cm-IG <= user@domain.com
I need sed/awk operation on this, so that it should print the very next pattern only after the the pattern mach <=
ie only print user@domain.com (7 Replies)
Hello Experts , require help . See below output:
File inputs
------------------------------------------
Server Host = mike
id rl images allocated last updated density
vimages expiration last read <------- STATUS ------->... (4 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)
Discussion started by: Klasform
9 Replies
LEARN ABOUT LINUX
erl_format
erl_format(3erl) C Library Functions erl_format(3erl)NAME
erl_format - Create and Match Erlang Terms
DESCRIPTION
This module contains two routines - one general function for creating Erlang terms and one for pattern matching Erlang terms.
EXPORTS
ETERM * erl_format(FormatStr, ... )
Types char *FormatStr;
This is a general function for creating Erlang terms using a format specifier and a corresponding set of arguments, much in the way
printf() works.
FormatStr is a format specification string. The set of valid format specifiers is as follows:
* ~i - Integer
* ~f - Floating point
* ~a - Atom
* ~s - String
* ~w - Arbitrary Erlang term
For each format specifier that appears in FormatStr , there must be a corresponding argument following FormatStr . An Erlang term is
built according to the FormatStr with values and Erlang terms substituted from the corresponding arguments and according to the
individual format specifiers. For example:
erl_format("[{name,~a},{age,~i},{data,~w}]",
"madonna",
21,
erl_format("[{adr,~s,~i}]","E-street",42));
This will create an (ETERM *) structure corresponding to the Erlang term: [{name,madonna},{age,21},{data,[{adr,"E-street",42}]}]
The function returns an Erlang term, or NULL if FormatStr does not describe a valid Erlang term.
int erl_match(Pattern, Term)
Types ETERM *Pattern,*Term;
This function is used to perform pattern matching similar to that done in Erlang. Refer to an Erlang manual for matching rules and
more examples.
Pattern is an Erlang term, possibly containing unbound variables.
Term is an Erlang term that we wish to match against Pattern .
Term and Pattern are compared, and any unbound variables in Pattern are bound to corresponding values in Term .
If Term and Pattern can be matched, the function returns a non-zero value and binds any unbound variables in Pattern . If Term Pat-
tern do not match, the function returns 0. For example:
ETERM *term, *pattern, *pattern2;
term1 = erl_format("{14,21}");
term2 = erl_format("{19,19}");
pattern1 = erl_format("{A,B}");
pattern2 = erl_format("{F,F}");
if (erl_match(pattern1, term1)) {
/* match succeeds:
* A gets bound to 14,
* B gets bound to 21
*/
...
}
if (erl_match(pattern2, term1)) {
/* match fails because F cannot be
* bound to two separate values, 14 and 21
*/
...
}
if (erl_match(pattern2, term2)) {
/* match succeeds and F gets bound to 19 */
...
}
erl_var_content() can be used to retrieve the content of any variables bound as a result of a call to erl_match() .
Ericsson AB erl_interface 3.7.3 erl_format(3erl)