Hi,
I'm trying to get one field out of many as follows:
A string of multiple fields separated with "/" characters:
"/ab=12/cd=34/12=ab/34=cd/ef=pick-this.one/gh=blah/ij=something/"
I want to pick up the field "ef=pick-this.one" which has no regular pattern except it starts with "ef=xxxx"... (3 Replies)
Id like to delete a line from a file using (preferably a single line unix command) if it contains a certain string pattern.
If line contains "abcdef" then delete that line.
Help greatly appreciated. (7 Replies)
Hi,
In principle I am searching for a Perl equivalent for this sed command:
sed "/TIM_AM_ARGS=/ s/60/1440/" $EDIT_FILE > $TEMP_FILE
cp $TEMP_FILE $EDIT_FILE
I was wondering if it needs to be like this, or that there other, shorter, alternatives:
open (TIMENVFILE, "<$timenvfile") or die... (5 Replies)
Hi Everyone,
I have:
$val="QQ3_1899_CD4".
The output will be:
1899.
I did $val =~ /(\d+)/g; the output is 318994, then i use substr to get those 1899. This is not efficient.
Is any simple way, like just one line can do? Thanks (1 Reply)
Hi all,
i've a string
$DIR=/u/user/NDE/TEST_LOGS/20110622_000005_TEST_11_HD_120/HD/TEST_11_HD_120/hd-12
i need to extract string from 2011.... i.e i need it as 20110622_000005_TEST_11_HD_120 as matched string, and in turn i need to split values 20110622_000005_TEST_11_HD_120 into two.... (6 Replies)
I have a list of strings in file:
10 10 AAA
120 13 BBBBB
23 11 CCCCC
11 32 DDDDDD
I want to replace first column of the text such as: 10, 129, 23, 11 with 11, 22, 33, 44.
I can do line by line, but just not sure how to replace partial string without... (1 Reply)
Hi Guys,
I need replace part of string in a file.
for example:
ABC=123
CDE=122
DEF=456
ABC=123
DED=333
ABC=123
I need replace the value after ABC=, highlighted in red. I want to get following result;
ABC=456
CDE=122
DEF=456
ABC=456
DED=333
ABC=456
Anybody can help me this.
... (8 Replies)
Hi Perl users,
I have another problem with text processing in Perl. I have a file below:
Linux Unix Linux Windows SUN
MACOS SUN SUN HP-AUX
I want the result below:
Unix Windows SUN
MACOS HP-AUX
so the duplicate string will be removed and also the keyword of the string on... (2 Replies)
Trying to combine strings that are a partial match to another in $1 (usually below it). If a match is found than the $2 value is added to the $2 value of the match and the $3 value is added to the $3 value of the match. I am not sure how to do this and need some expert help. Thank you :).
file
... (2 Replies)
I have the below string which i need to compare with a file and replace this string in the file which matches closely. Can anyone help me on this.
string(Scenario 1)- user::r--,user::ourfrd:r--
String(Scenario 2)- user::r--
File
****
# file: /local/Desktop/myfile
# owner: me
# group:... (6 Replies)
Discussion started by: sarathy_a35
6 Replies
LEARN ABOUT DEBIAN
openguides::test
OpenGuides::Test(3pm) User Contributed Perl Documentation OpenGuides::Test(3pm)NAME
OpenGuides::Test - Methods to help test OpenGuides applications.
DESCRIPTION
Provides methods to help when writing tests for OpenGuides. Distributed and installed as part of the OpenGuides project, not intended for
independent installation. This documentation is probably only useful to OpenGuides developers.
SYNOPSIS
use OpenGuides;
use OpenGuides::Test;
OpenGuides::Test::refresh_db();
my $config = OpenGuides::Test->make_basic_config;
$config->default_language( "nl" );
my $guide = OpenGuides->new( config => $config );
OpenGuides::Test->write_data(
guide => $guide,
node => "Crabtree Tavern",
os_x => 523465,
os_y => 177490,
categories => "Pubs",
);
METHODS
make_basic_config
my $config = OpenGuides::Test->make_basic_config;
$config->default_language( "nl" );
Makes an OpenGuides::Config object with needed fields pre-filled. You can mess with it as you like then.
write_data
my $config = OpenGuides::Test->make_basic_config;
my $guide = OpenGuides->new( config => $config );
OpenGuides::Test->write_data(
guide => $guide,
node => "Crabtree Tavern",
os_x => 523465,
os_y => 177490,
categories => "Pubs
Pub Food",
);
This method calls the "make_cgi_object" method to make its CGI object; you can supply values for any key mentioned there. You should
supply them exactly as they would come from a CGI form, eg lines in a textarea are separated by "
".
This method will automatically grab the checksum from the database, so even if the node already exists your data will still be written.
If you don't want this behaviour (for example, if you're testing edit conflicts) then pass in a true value to the "omit_checksum"
parameter:
OpenGuides::Test->write_data(
guide => $guide,
node => "Crabtree Tavern",
omit_checksum => 1,
);
If you want to grab the output, pass a true value to "return_output":
my $output = OpenGuides::Test->write_data(
guide => $guide,
node => "Crabtree Tavern",
return_output => 1,
);
Similarly, if you pass a true value to "return_tt_vars", the return value will be the variables which would have been passed to the
template for output:
my %vars = OpenGuides::Test->write_data(
guide => $guide,
node => "Crabtree Tavern",
return_tt_vars => 1,
);
make_cgi_object
my $q = OpenGuides::Test->make_cgi_object;
You can supply values for the following keys: "content", "categories", "locales", "node_image", "node_image_licence",
"node_image_copyright", "node_image_url", "phone", "fax", "website", "hours_text", "address", "postcode", "map_link", "os_x", "os_y",
"osie_x", "osie_y", "latitude", "longitude", "summary", "username", "comment", "edit_type". You should supply them exactly as they
would come from a CGI form, eg lines in a textarea are separated by "
".
refresh_db
Openguides::Test::refresh_db();
Unlink the existing SQLite database t/node.db and plucene indexes. Then create a new SQLite database t/node.db
AUTHOR
The OpenGuides Project (openguides-dev@lists.openguides.org)
COPYRIGHT
Copyright (C) 2004-2009 The OpenGuides Project. All Rights Reserved.
This module is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
perl v5.14.2 2013-01-11 OpenGuides::Test(3pm)