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
prima::editdialog
Prima::EditDialog(3) User Contributed Perl Documentation Prima::EditDialog(3)NAME
Prima::FindDialog, Prima::ReplaceDialog - standard interface dialogs to find and replace options selection.
SYNOPSIS
use Prima::StdDlg;
my $dlg = Prima::FindDialog-> create( findStyle => 0);
my $res = $dlg-> execute;
if ( $res == mb::Ok) {
print $dlg-> findText, " is to be found
";
} elsif ( $res == mb::ChangeAll) {
print "all occurences of ", $dlg-> findText,
" is to be replaced by ", $dlg-> replaceText;
}
The "mb::ChangeAll" constant, one of possible results of "execute" method, is defined in Prima::StdDlg module. Therefore it is recommended
to include this module instead.
DESCRIPTION
The module provides two classes - Prima::FindDialog and Prima::ReplaceDialog; Prima::ReplaceDialog is exactly same as Prima::FindDialog
except that its default findStyle property value is set to 0. One can use a dialog-caching technique, arbitrating between findStyle value 0
and 1, and use only one instance of Prima::FindDialog.
The module does not provide the actual search algorithm; this must be implemented by the programmer. The toolkit currently include some
facilitation to the problem - the part of algorithm for "Prima::Edit" class is found in "find" in Prima::Edit, and the another part - in
examples/editor.pl example program. Prima::HelpWindow also uses the module, and realizes its own searching algorithm.
API
Properties
All the properties select the user-assigned values, except findStyle.
findText STRING
Selects the text string to be found.
Default value: ''
findStyle BOOLEAN
If 1, the dialog provides only 'find text' interface. If 0, the dialog provides also 'replace text' interface.
Default value: 1 for "Prima::FindDialog", 0 for "Prima::ReplaceDialog".
options INTEGER
Combination of "fdo::" constants. For the detailed description see "find" in Prima::Edit.
fdo::MatchCase
fdo::WordsOnly
fdo::RegularExpression
fdo::BackwardSearch
fdo::ReplacePrompt
Default value: 0
replaceText STRING
Selects the text string that is to replace the found text.
Default value: ''
scope
One of "fds::" constants. Represents the scope of the search: it can be started from the cursor position, of from the top or of the
bottom of the text.
fds::Cursor
fds::Top
fds::Bottom
Default value: "fds::Cursor"
AUTHOR
Dmitry Karasik, <dmitry@karasik.eu.org>.
SEE ALSO
Prima, Prima::Window, Prima::StdDlg, Prima::Edit, Prima::HelpWindow, examples/editor.pl
perl v5.14.2 2009-02-24 Prima::EditDialog(3)