Find a text and if condition matches then replace it
Need a script that can find text in a file and replace it accordingly.
This is the file I have:
In this file I need a script that can look for the number after week in week1offlineserver.txt and replace it like: If number is 1, change it to 2, if number is 2 then to 3 and if it is 3 then to 4 and if it is 4 then to 1.
Last edited by Scrutinizer; 09-08-2018 at 04:35 PM..
Dear friends please help,
I have a large data file with few hundred lines. A small example is shown below:
datafile is a file with few hundred lines with the third column has many different character stings:
test 100 abc
test 134 bcd
test 356 cdf
test 831 dfg
test 720 fgh
I need to... (6 Replies)
I have an html file that looks like this (this is just a part of the html file):
<td colspan="3" rowspan="1" style="text-align: center; background-color: rgb(<!-- IDENTIFIER1 -->51, 255, 51);"><small><!-- IDENTIFIER2 -->UP</small></td>
This is to automatically update the status of the... (4 Replies)
Hey Fellas.
I am new to scripting. I have searched through the forums and found a lot of good info, but I can't seem to get any of it to work together. I am trying to find a particular sting in a file, and if the next string matches certain criteria, replace it with a string from a csv... (6 Replies)
Hi.
I would like to have experts help on below action.
I have text files in which page nubmers exists in form like
PAGE : 1
PAGE : 2
PAGE : 3 and so on there is other text too. I would like to know is it possible to check the last occurance of Page... (6 Replies)
Hi All,
I want to change the name as SEQ_13
ie., <Property Name="Name">SEQ_13</Property>
when the Stage Type is PxSequentialFile
ie., <Property Name="StageType">PxSequentialFile</Property> :wall:
Input.XML
<Main>
<Record Identifier="V0S13" Type="CustomStage" Readonly="0">... (3 Replies)
Hello,
I have a 100 line code. I have given a sample of it below:
ABC*654654*1*54.54*21.2*87*1*654654654654
CCC*FS*FS*SFD*DSF
GGG*FGH*CGB*FBDFG*FGDG
ABC*654654*1*57.84*45.4*88*2*6546546545
CCC*WSF*SG*FGH*GHJ
ADA*AF*SFG*DFGH*FGH*FGTH
I need to select the line starting with "ABC" its... (3 Replies)
Hello everyone,
I am trying to create function or script to send email from an address book file.
Here is the file format i have,
Susan:Miller:M:123 Main Street:Philadelphia:PA:17101:666-645-6666:Susan.Miller@gmail.com:07/12/1979 Robert:Langan:S:32 North Avenue:San... (5 Replies)
Hi All,
I have a XML file which is looks like as below. <<please see the attachment >>
<?xml version="1.0" encoding="UTF-8"?>
<esites>
<esite>
<name>XXX.com</name>
<storeId>10001</storeId>
<module>
... (4 Replies)
Dear Friends,
I have a flat file which is as follows
$cat sample
123,456,1,1,1,1
sdfas,345,1,1,1,1
dfgd,234,2,3,4,1
ggffgr,234,4,3,2,1
jkhu,354.1,1,1,1
$
I want to get output of only those lines which has '1' in 3 to 5 position.
So I want output as follows
123,456,1,1,1,1... (8 Replies)
Discussion started by: anushree.a
8 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)