01-16-2006
Extract data from file
Dear All ,
I am posting first time in this forum . Please ignore my mistakes .
I am learning Unix and i need help to extract specific data from file .
1. I want to grep number of fails from log . The file contains "fails" word in line if test cases are failed .
2. The log contains results for different version . i want to count total number of fails on different version .
3. The log contains more than 1000 lines and searching fails is very difficult for me .
Example-
version 10--- passed
vesrion 10 --- fails
version 10 -- passed
version9 -- passed
version9 - fails
please help me to write shell scripting
regards
dips
10 More Discussions You Might Find Interesting
1. Shell Programming and Scripting
My file in ksh consists of message data of varying lengths (lines), separated with headers.
I would like to find a string from this file, and print out the whole message data including the headers.
my plan of attack is to search the strings, print the top header, and print the whole message... (2 Replies)
Discussion started by: apalex
2 Replies
2. Shell Programming and Scripting
Hello again, how do you extract data from a file? I have created a file with PID #s in it, I need to be able to take the PID from each line and kill it. How is this done? (4 Replies)
Discussion started by: raidzero
4 Replies
3. Shell Programming and Scripting
I m new to shell scripting & i need a help....
i have file like....
Name := sachin
address:=something
phone:=111
...
Note: There might be or not space between Name & := and between := & sachin. I need to extract the data from each line of file as
var1=Name
value1=sachin
same for... (13 Replies)
Discussion started by: ps_sach
13 Replies
4. Shell Programming and Scripting
I need to create a script to extract some specific data from a file. I locate the file using the find command:
find . -name "rpbol*" -print | xargs grep -li
Once I locate the file I need using the above command, I would like to extract some data from that file. The data is always located... (2 Replies)
Discussion started by: jevaba
2 Replies
5. Shell Programming and Scripting
My input file:
data_5 Ali 422 2.00E-45 102/253 140/253 24
data_3 Abu 202 60.00E-45 12/23 140/23 28
data_1 Ahmad 256 7.00E-45 120/235 140/235 22
data_4 Aman 365 8.00E-45 15/65 140/65 20
data_10 Jones 869 9.00E-45 65/253 140/253 18... (12 Replies)
Discussion started by: patrick87
12 Replies
6. Shell Programming and Scripting
Hello,
Hope you are doing fine. I have been struggling with it for some time now and I would really appreciate your help.
Following is file format:
Currency,Name,Date, Term
USD, ABC, 2011/11/11, T0, S1, S2, S3, S4
, , ,T1, 5.6, 2.3, 6.5, 4.5
, ... (5 Replies)
Discussion started by: srattani
5 Replies
7. Shell Programming and Scripting
Hi, Great minds, I have some files, in fact header files, of CTD profiler, I tried a lot C programming, could not get output as I was expected, because my programming skills are very poor, finally, joined unix forum with the hope that, I may get what I want, from you people,
Here I have attached... (17 Replies)
Discussion started by: nex_asp
17 Replies
8. Shell Programming and Scripting
Hello All,
I have a small xml file which looks like below:
<Check:defaultval Val="crash" value="crash_report_0013
generate_check_0020 generate_check_0022

This is where the fault is."/>
<Check:defaultval Val="crash" value="crash_report_1001
generate_check_1001... (9 Replies)
Discussion started by: suvendu4urs
9 Replies
9. Shell Programming and Scripting
I have a text file that contains the following data. For example, aa.txt has some numbers. I need to extract the continuous numbers(minimum 3 numbers) from it.How can I do this with awk?
>aa.txt
31
35
36
37
38
39
44
169
170
173
174
175
177
206
>1a.txt
39 (5 Replies)
Discussion started by: rahmanabdulla
5 Replies
10. Shell Programming and Scripting
Hi ,
I am having a file which is PIPE delimited like this :
file.txt
aus|start|10:00:00
nz|start|11:00:00
aus|end|10:10:00
us|start|10:00:00
nz|end|11:10:00
us|end|11:00:00
.
.
.
I want to extract an output file like this based on start time and end time for each countries: (9 Replies)
Discussion started by: rohit_shinez
9 Replies
LEARN ABOUT DEBIAN
test::www::declare
Test::WWW::Declare(3pm) User Contributed Perl Documentation Test::WWW::Declare(3pm)
NAME
Test::WWW::Declare - declarative testing for your web app
SYNOPSIS
use Test::WWW::Declare tests => 3;
use Your::Web::App::Test;
Your::Web::App::Test->start_server;
session 'testuser' => run {
flow 'log in and out' => check {
flow 'log in' => check {
get 'http://localhost/';
fill form 'login' => {
username => 'testuser',
password => 'drowssap',
};
content should contain 'log out';
};
flow 'log out' => check {
get 'http://localhost/';
click href 'log out';
};
};
};
DESCRIPTION
Often in web apps, tests are very dependent on the state set up by previous tests. If one test fails (e.g. "follow the link to the admin
page") then it's likely there will be many more failures. This module aims to alleviate this problem, as well as provide a nicer interface
to Test::WWW::Mechanize.
The central idea is that of "flow". Each flow is a sequence of commands ("fill in this form") and assertions ("content should contain
'testuser'"). If any of these commands or assertions fail then the flow is aborted. Only that one failure is reported to the test harness
and user. Flows may also contain other flows. If an inner flow fails, then the outer flow fails as well.
FLOWS AND SESSIONS
session NAME => run { CODE }
Sessions are a way of associating a set of flows with a WWW::Mechanize instance. A session is mostly equivalent with a user interacting
with your web app.
Within a session, every command ("get", "click link", etc) is operating on that session's WWW::Mechanize instance. You may have multiple
sessions in one test file. Two sessions with the same name are in fact the same session. This lets you write code like the following,
simplified slightly:
session 'first user' => run {
get "$URL/give?task=1&victim=other";
session 'other user' => run {
get "$URL/tasks";
content should match qr/task 1/;
# this is the same session/mech as the outermost 'first user'
session 'first user' => run {
get "$URL/tasks";
content shouldnt match qr/task 1/;
};
};
};
flow NAME => check { CODE }
A flow encompasses a single test. As described above, each flow is a sequence of commands, assertions, and other flows. If any of the
components of a flow fail, the rest of the flow is aborted and one or more test failures are reported to the test harness.
COMMANDS
get URL
click button
click href
follow_link
fill form NAME => {FIELD1 => VALUE1, FIELD2 => VALUE2}
ASSERTIONS
Every assertion has two parts: a subject and a verb.
SUBJECTS
content
title
url
VERBS
should(nt) (caselessly) match REGEX
should(nt) (caselessly) contain STRING
should(nt) (caselessly) lack STRING
should(nt) (caselessly) equal STRING
SUBCLASSING
One of the goals of this module is to let you subclass it to provide extra features, such as automatically logging in a user each time a
session is created.
CAVEATS
If you fail any tests, then the actual number of tests run may be fewer than you have in your file. This is because when a flow fails, it
immediately aborts the rest of its body (which may include other flows). So if you're setting the number of tests based on how many ran,
make sure that all tests passed.
BUGS
Hopefully few. We'd like to know about any of them. Please report them to "bug-test-www-declare@rt.cpan.org".
SEE ALSO
Test::WWW::Mechanize, Jifty.
MAINTAINER
Shawn M Moore "<sartak@bestpractical.com>"
ORIGINAL AUTHOR
Jesse Vincent "<jesse@bestpractical.com>"
COPYRIGHT
Copyright 2007-2008 Best Practical Solutions, LLC
This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
perl v5.14.2 2008-10-12 Test::WWW::Declare(3pm)