10 More Discussions You Might Find Interesting
1. Shell Programming and Scripting
Hi
I use sed comnand to remove occurance of one workd from a line.
However I need to removed occurance of dufferent words in ne line.
Original-1 Hi this is the END of my begining
Comand sed s/"END"/"start"/g
Output-1 Hi this is the start of my beginig
But I have more... (9 Replies)
Discussion started by: mnassiri
9 Replies
2. Shell Programming and Scripting
I need to extract multiple occurance strings between 2 different patterns in given line.
For e.g. in below as input
-------------------------------------------------------------------------------------
mike(hussey) AND mike(donald) AND mike(ryan) AND mike(johnson)... (8 Replies)
Discussion started by: sameermohite
8 Replies
3. Shell Programming and Scripting
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)
Discussion started by: chrissycc
8 Replies
4. Shell Programming and Scripting
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)
Discussion started by: genzo
5 Replies
5. Shell Programming and Scripting
Hi ,
I'm a newbie.Never worked on Unix before. I want a shell script to perform the following:
I want to extract strings from each line ,based on the type of line(Nameline,Subline) and output it to another file.Below is a sample format.
2010-12-21 14:00"1"Nameline"Midterm"First Name:Jane ... (4 Replies)
Discussion started by: angie1234
4 Replies
6. Shell Programming and Scripting
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)
Discussion started by: satish.vampire
8 Replies
7. Shell Programming and Scripting
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)
Discussion started by: satish.vampire
5 Replies
8. Shell Programming and Scripting
Hi all,
The following lines are taken from a long paragraph:
Labels of output orbitals: RY* RY* RY* RY* RY* RY*
1\1\GINC-COMPUTE-1-3\SP\UB3LYP\6-31G\C2H5Cr1O1(1+,5)\LIUZHEN\19-Jan-20
10\0\\# ub3lyp/6-31G pop=(nbo,savenbo) gfprint\\E101GECP\\1,5\O,0,-1.7
... (1 Reply)
Discussion started by: liuzhencc
1 Replies
9. Shell Programming and Scripting
I've got this command that I've been using to find strings on the same line, say I'm doing a search for name:
find . -name "*" | xargs grep -i "Doe" | grep -i "John" > output.txt
This gives me every line in a file that has John and Doe in it. I'm looking to add a OR operator for the second... (5 Replies)
Discussion started by: Rally_Point
5 Replies
10. Shell Programming and Scripting
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)
Discussion started by: vin_eme
3 Replies
exstr(1) User Commands exstr(1)
NAME
exstr - extract strings from source files
SYNOPSIS
exstr filename...
exstr -e filename...
exstr -r [-d] filename...
DESCRIPTION
The exstr utility is used to extract strings from C-language source files and replace them by calls to the message retrieval function (see
gettxt(3C)). This utility will extract all character strings surrounded by double quotes, not just strings used as arguments to the printf
command or the printf routine. In the first form, exstr finds all strings in the source files and writes them on the standard output. Each
string is preceded by the source file name and a colon (:).
The first step is to use exstr -e to extract a list of strings and save it in a file. Next, examine this list and determine which strings
can be translated and subsequently retrieved by the message retrieval function. Then, modify this file by deleting lines that can't be
translated and, for lines that can be translated, by adding the message file names and the message numbers as the fourth (msgfile) and
fifth (msgnum) entries on a line. The message files named must have been created by mkmsgs(1) and exist in /usr/lib/locale/locale/LC_MES-
SAGES . (The directory locale corresponds to the language in which the text strings are written; see setlocale(3C)). The message numbers
used must correspond to the sequence numbers of strings in the message files.
Now use this modified file as input to exstr -r to produce a new version of the original C-language source file in which the strings have
been replaced by calls to the message retrieval function gettxt(). The msgfile and msgnum fields are used to construct the first argument
to gettxt(). The second argument to gettxt() is printed if the message retrieval fails at run-time. This argument is the null string,
unless the -d option is used.
This utility cannot replace strings in all instances. For example, a static initialized character string cannot be replaced by a function
call. A second example is that a string could be in a form of an escape sequence which could not be translated. In order not to break
existing code, the files created by invoking exstr -e must be examined and lines containing strings not replaceable by function calls must
be deleted. In some cases the code may require modifications so that strings can be extracted and replaced by calls to the message
retrieval function.
OPTIONS
The following options are supported:
-e Extract a list of strings from the named C-language source files, with positional information. This list is produced on standard
output in the following format:
file:line:position:msgfile:msgnum:string
file the name of a C-language source file
line line number in the file
position character position in the line
msgfile null
msgnum null
string the extracted text string
Normally you would redirect this output into a file. Then you would edit this file to add the values you want to use for msgfile
and msgnum:
msgfile the file that contains the text strings that will replace string. A file with this name must be created and
installed in the appropriate place by the mkmsgs(1) utility.
msgnum the sequence number of the string in msgfile.
The next step is to use exstr -r to replace strings in file.
-r Replace strings in a C-language source file with function calls to the message retrieval function gettxt().
-d This option is used together with the -r option. If the message retrieval fails when gettxt() is invoked at run-time, then the
extracted string is printed. You would use the capability provided by exstr on an application program that needs to run in an
international environment and have messages print in more than one language. exstr replaces text strings with function calls that
point at strings in a message data base. The data base used depends on the run-time value of the LC_MESSAGES environment variable
(see environ(5)).
EXAMPLES
Example 1: The following examples show uses of exstr
Assume that the file example.c contains two strings:
main()
{
printf("This is an example
");
printf("Hello world!
");
}
The exstr utility, invoked with the argument example.c extracts strings from the named file and prints them on the standard output.
example% exstr example.c
produces the following output:
example.c:This is an example
example.c:Hello world!
The exstr utility, invoked with the -e option and the argument example.c, and redirecting output to the file example.stringsout
example% exstr -e example.c > example.stringsout
produces the following output in the file example.stringsout
example.c:3:8:::This is an example
example.c:4:8:::Hello world!
You must edit example.stringsout to add the values you want to use for the msgfile and msgnum fields before these strings can be replaced
by calls to the retrieval function. If UX is the name of the message file, and the numbers 1 and 2 represent the sequence number of the
strings in the file, here is what example.stringsout looks like after you add this information:
example.c:3:8:UX:1:This is an example
example.c:4:8:UX:2:Hello world!
The exstr utility can now be invoked with the -r option to replace the strings in the source file by calls to the message retrieval func-
tion gettxt().
example% exstr -r example.c <example.stringsout >intlexample.c
produces the following output:
extern char *gettxt();
main()
{
printf(gettxt("UX:1", ""));
printf(gettxt("UX:2", ""));
}
The following example:
example% exstr -rd example.c <example.stringsout >intlexample.c
uses the extracted strings as a second argument to gettxt():
extern char *gettxt();
main()
{
printf(gettxt("UX:1", "This is an example
"));
printf(gettxt("UX:2", "Hello world!
"));
}
FILES
/usr/lib/locale/locale/LC_MESSAGES/*
files created by mkmsgs(1)
ATTRIBUTES
See attributes(5) for descriptions of the following attributes:
+-----------------------------+-----------------------------+
| ATTRIBUTE TYPE | ATTRIBUTE VALUE |
+-----------------------------+-----------------------------+
|Availability |SUNWtoo |
+-----------------------------+-----------------------------+
SEE ALSO
gettxt(1), mkmsgs(1), printf(1), srchtxt(1), gettxt(3C), printf(3C), setlocale(3C), attributes(5), environ(5)
DIAGNOSTICS
The error messages produced by exstr are intended to be self-explanatory. They indicate errors in the command line or format errors encoun-
tered within the input file.
SunOS 5.10 5 Jul 1990 exstr(1)