I have this file generated by me... i want to create some HTML output from it.
The problem is that i am really confused about how do I go about reading the file.
The file is in the following format:
The file can continue this way as long as it wants. The A type (for that matter any type) might be repeated again too.
But there would always be 3 fields for a given type, Time, Result and ExpectedResult.
I need to consolidate all of these values for all the different types (A, B, etc.) and create a tabular report for them.
What does "consolidate" mean? What do you want to do with the line?
What type of output do you want?
Is this something like it:
Quote:
Oh, yes, forgot to mention.... I'm using a shell based on zsh.
Use POSIX shell syntax for scripting; use extensions only when it is more efficient.
hi
i am new to shelll scripting
I need to parse a string like "abc,def,ghie,jkl"
And assign them to some variables like
hs1 = abc
hs2 = def
hs3 = ghi
hs4 = jkl
Please help (4 Replies)
I need the perl solution for the following :
$string="I LOVE INDIA"
now, in a new string i need the first character of each word...
that is string2 should be "ILN". (10 Replies)
Hi,
name=VDSL_TTV_ HN_SUB create coid=MA5603U phone=5678 portpolicy=APortSelectionPolicy rfu10=TTV rfu3=Dot1q sz7_portmode=VDSL2 rfu5=1234 srprofile.sy_profname=$ADSL_TTV_SubProfile1
I have a line like this. Its a single line.I need the output as
name=VDSL_TTV_ HN_SUB create... (1 Reply)
for i in `cat list`;do lol=`curl -m 2 -s ${i} | grep 'class=info' | cut -d '>' -f14 | cut -d '<' -f1 | sed '/^$/d'`; if ;then echo "$i,$lol" >> dirty; echo "$i,$lol";fi; done
cut: you must specify a list of bytes, characters, or fields
Try `cut --help' for more information.
it gave me that... (0 Replies)
Hi everyone,
I am working on fetchmail + procmail to filter mails and I am having problem with parsing a long line in the body of the email.
Could anyone help me construct a reg exp for this string below. It needs to match exactly as this string.
GetRyt... (4 Replies)
Hello all;
lat week I was able to get some assistance on creating a summary report from a file generated by a "comm" comparison of twp CSV files...turn out now that I am being asked for a detail report as well...this is beyond my knowledge of perl (and yes I have to use perl)..also please keep... (5 Replies)
Hi,
I need some advise on how to print 'sections' of the attached file. I am searching for some that says Marked Corrupt and print some lines after it.
At the moment I am running the command below:
sed -n -e '/Marked Corrupt/{N;N;p;}' rman_list_validate.txtThis gives me the following... (1 Reply)
The log file is huge and lot of information, i would like to parse and make a report .
below is the log file looks like:
REPORT DATE: Mon Aug 10 04:16:17 CDT 2017
SYSTEN VER: v1.3.0.9
TERMINAL TYPE: prod
SYSTEM: nb11cu51
UPTIME: 04:16AM up 182 days 57 mins min
MODEL, TYPE, and SN:... (8 Replies)
Discussion started by: amir07
8 Replies
LEARN ABOUT LINUX
strtok_r
STRTOK(3) Linux Programmer's Manual STRTOK(3)NAME
strtok, strtok_r - extract tokens from strings
SYNOPSIS
#include <string.h>
char *strtok(char *str, const char *delim);
char *strtok_r(char *str, const char *delim, char **saveptr);
Feature Test Macro Requirements for glibc (see feature_test_macros(7)):
strtok_r(): _SVID_SOURCE || _BSD_SOURCE || _POSIX_C_SOURCE >= 1 || _XOPEN_SOURCE || _POSIX_SOURCE
DESCRIPTION
The strtok() function parses a string into a sequence of tokens. On the first call to strtok() the string to be parsed should be specified
in str. In each subsequent call that should parse the same string, str should be NULL.
The delim argument specifies a set of characters that delimit the tokens in the parsed string. The caller may specify different strings in
delim in successive calls that parse the same string.
Each call to strtok() returns a pointer to a null-terminated string containing the next token. This string does not include the delimiting
character. If no more tokens are found, strtok() returns NULL.
A sequence of two or more contiguous delimiter characters in the parsed string is considered to be a single delimiter. Delimiter charac-
ters at the start or end of the string are ignored. Put another way: the tokens returned by strtok() are always nonempty strings.
The strtok_r() function is a reentrant version strtok(). The saveptr argument is a pointer to a char * variable that is used internally by
strtok_r() in order to maintain context between successive calls that parse the same string.
On the first call to strtok_r(), str should point to the string to be parsed, and the value of saveptr is ignored. In subsequent calls,
str should be NULL, and saveptr should be unchanged since the previous call.
Different strings may be parsed concurrently using sequences of calls to strtok_r() that specify different saveptr arguments.
RETURN VALUE
The strtok() and strtok_r() functions return a pointer to the next token, or NULL if there are no more tokens.
CONFORMING TO
strtok()
SVr4, POSIX.1-2001, 4.3BSD, C89, C99.
strtok_r()
POSIX.1-2001.
BUGS
Be cautious when using these functions. If you do use them, note that:
* These functions modify their first argument.
* These functions cannot be used on constant strings.
* The identity of the delimiting character is lost.
* The strtok() function uses a static buffer while parsing, so it's not thread safe. Use strtok_r() if this matters to you.
EXAMPLE
The program below uses nested loops that employ strtok_r() to break a string into a two-level hierarchy of tokens. The first command-line
argument specifies the string to be parsed. The second argument specifies the delimiter character(s) to be used to separate that string
into "major" tokens. The third argument specifies the delimiter character(s) to be used to separate the "major" tokens into subtokens.
An example of the output produced by this program is the following:
$ ./a.out 'a/bbb///cc;xxx:yyy:' ':;' '/'
1: a/bbb///cc
--> a
--> bbb
--> cc
2: xxx
--> xxx
3: yyy
--> yyy
Program source
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
int
main(int argc, char *argv[])
{
char *str1, *str2, *token, *subtoken;
char *saveptr1, *saveptr2;
int j;
if (argc != 4) {
fprintf(stderr, "Usage: %s string delim subdelim
",
argv[0]);
exit(EXIT_FAILURE);
}
for (j = 1, str1 = argv[1]; ; j++, str1 = NULL) {
token = strtok_r(str1, argv[2], &saveptr1);
if (token == NULL)
break;
printf("%d: %s
", j, token);
for (str2 = token; ; str2 = NULL) {
subtoken = strtok_r(str2, argv[3], &saveptr2);
if (subtoken == NULL)
break;
printf(" --> %s
", subtoken);
}
}
exit(EXIT_SUCCESS);
} /* main */
SEE ALSO index(3), memchr(3), rindex(3), strchr(3), string(3), strpbrk(3), strsep(3), strspn(3), strstr(3), wcstok(3)COLOPHON
This page is part of release 3.27 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 2010-09-20 STRTOK(3)