12-28-2018
Thanks for the response vgersh99 . Honestly, I am new to using unix. I tried some options with awk but the results are not matching with my requirement. Any help would be appreciated.
10 More Discussions You Might Find Interesting
1. Shell Programming and Scripting
Hello,
I have the following xml formatted file. I would like to get the newnumber field number and replace into customernumber for each record.
For example:
<XMLFORMAT>
<customernumberR11>9</customernumberR11>
... (12 Replies)
Discussion started by: happyv
12 Replies
2. Shell Programming and Scripting
Hi,
I am new to unix and am trying to do something below:
I have a pipe delimited file with millions of records. I need to replace the third column of the first record to the number of lines in the file. How can I do that.
Will appreciate any advice and help.
Thanks
Simi (3 Replies)
Discussion started by: simi28
3 Replies
3. Shell Programming and Scripting
Hi,
i want to replace comma by space for specified field in record, i mean i want to replace the commas in the 4th field by space. and rest all is same throught the record.
the record is
16458,99,001,"RIMOUSKI, QC",418,"N",7,EST,EDT,902
16458,99,002,"CHANDLER,... (5 Replies)
Discussion started by: raghavendra.cse
5 Replies
4. Shell Programming and Scripting
Hello,
I have a text file with n lines in the following format (9 column fields):
Example:
contig00012 149606 G C 49 68 60 18 c$cccccacccccccccc^c
I need to count the number of lower-case and upper-case occurences in column 9, respectively, of the... (3 Replies)
Discussion started by: s052866
3 Replies
5. Shell Programming and Scripting
Hello Group,
I need to replace the city field in “File 1 (fileld 3), with the entire record line of “File 2” (including delimiters) where the “city” field (File 1, Field 3)matches city field (File 2, Field1). All of the other data in “File 1” should remain intact(Fields 1,2,4,5,6). Only field... (1 Reply)
Discussion started by: vestport
1 Replies
6. Shell Programming and Scripting
Hi all,
I have a requirement to replace a field with a character as per the length of the field.
Suppose i have a file where second field is of 20 character length. I want to replace second field with 20 stars (*). like ********************
As the field is not a fixed one, i want to do the... (2 Replies)
Discussion started by: gani_85
2 Replies
7. Shell Programming and Scripting
I have test.xml
<emp><id>101</id><name>AAA</name><date>06/06/14 1811</date></emp>
<Join><id>101</id><city>london</city><date>06/06/14 2011</date></join>
<Join><id>101</id><city>new york</city><date>06/06/14 1811</date></join>
<Join><id>101</id><city>sydney</city><date>06/06/14... (2 Replies)
Discussion started by: vsraju
2 Replies
8. Shell Programming and Scripting
Table
ACN|NAME|CITY|CTY|NO1|NO2
115|AKKK|ASH|IND|10|15
115|AKKK|ASH|IND|20|20
115|AKKK|ASH|IND|30|35
115|AKKK|ASH|IND|30|35
112|ABC|FL|USA|15|15
112|ABC|FL|USA|25|20
112|ABC|FL|USA|25|45
i have written shell script using cut command
and awk programming getting error correct it and add... (5 Replies)
Discussion started by: udhal
5 Replies
9. Shell Programming and Scripting
I have data coming in the below format for each record
<?xml version="1.0" encoding="UTF-8" standalone="no"?><test_sox xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"><testdetials>....</test_sox>
<?xml version="1.0" encoding="UTF-8" standalone="no"?><test_sox... (8 Replies)
Discussion started by: dsravanam
8 Replies
10. Shell Programming and Scripting
I have a csv dataset like this :
C,rs18768
G,rs13785
GA,rs1065
G,rs1801279
T,rs9274407
A,rs730012
I'm thinking of use like awk, sed to covert the dataset to this format: (if it's two character, then keep the same)
CC,rs18768
GG,rs13785
GA,rs1065
GG,rs1801279
TT,rs9274407... (7 Replies)
Discussion started by: nengcheng
7 Replies
RPMATCH(3) Linux Programmer's Manual RPMATCH(3)
NAME
rpmatch - determine if the answer to a question is affirmative or negative
SYNOPSIS
#include <stdlib.h>
int rpmatch(const char *response);
Feature Test Macro Requirements for glibc (see feature_test_macros(7)):
rpmatch(): _SVID_SOURCE
DESCRIPTION
rpmatch() handles a user response to yes or no questions, with support for internationalization.
response should be a null-terminated string containing a user-supplied response, perhaps obtained with fgets(3) or getline(3).
The user's language preference is taken into account per the environment variables LANG, LC_MESSAGES, and LC_ALL, if the program has called
setlocale(3) to effect their changes.
Regardless of the locale, responses matching ^[Yy] are always accepted as affirmative, and those matching ^[Nn] are always accepted as neg-
ative.
RETURN VALUE
After examining response, rpmatch() returns 0 for a recognized negative response ("no"), 1 for a recognized positive response ("yes"), and
-1 when the value of response is unrecognized.
ERRORS
A return value of -1 may indicate either an invalid input, or some other error. It is incorrect to only test if the return value is
nonzero.
rpmatch() can fail for any of the reasons that regcomp(3) or regexec(3) can fail; the cause of the error is not available from errno or
anywhere else, but indicates a failure of the regex engine (but this case is indistinguishable from that of an unrecognized value of
response).
CONFORMING TO
rpmatch() is not required by any standard, but is available on a few other systems.
BUGS
The rpmatch() implementation looks at only the first character of response. As a consequence, "nyes" returns 0, and "ynever; not in a mil-
lion years" returns 1. It would be preferable to accept input strings much more strictly, for example (using the extended regular expres-
sion notation described in regex(7)): ^([yY]|yes|YES)$ and ^([nN]|no|NO)$.
EXAMPLE
The following program displays the results when rpmatch() is applied to the string given in the program's command-line argument.
#define _SVID_SOURCE
#include <locale.h>
#include <stdlib.h>
#include <string.h>
#include <stdio.h>
int
main(int argc, char *argv[])
{
if (argc != 2 || strcmp(argv[1], "--help") == 0) {
fprintf(stderr, "%s response
", argv[0]);
exit(EXIT_FAILURE);
}
setlocale(LC_ALL, "");
printf("rpmatch() returns: %d
", rpmatch(argv[1]));
exit(EXIT_SUCCESS);
}
SEE ALSO
fgets(3), getline(3), nl_langinfo(3), regcomp(3), setlocale(3)
COLOPHON
This page is part of release 3.25 of the Linux man-pages project. A description of the project, and information about reporting bugs, can
be found at http://www.kernel.org/doc/man-pages/.
GNU
2007-07-26 RPMATCH(3)