Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:
I need to format it to look like this[get4] $uri=/LRA/RiskApplicationPage.aspx $method=GET [get5] $uri=/LRA/CSS/RiskManagement.css $method=GET
I want to take the text following the last / and copy it to the inside of the get before it. This is how I'm currently attempting it...[RiskApplicationPage.aspx get4] $uri=/LRA/RiskApplicationPage.aspx $method=GET [RiskManagement.css get5] $uri=/LRA/CSS/RiskManagement.css $method=GET
Any suggestions? Thanks#!C:\Perl\bin\perl -w use Getopt::Std; $USAGE = <<USAGE; Usage: Absolute_Path\\file A script to adjust the request ID and replace it with something a little more descriptive USAGE ; # process command line getopts('x') || die $USAGE; # get parameters $script = shift || die $USAGE; # rename .tst file to a .txt file chomp ($script); my $temp = $script; $temp =~ s/\.tsv$//; $new_script = join("", $temp, ".txt"); rename ($script, $new_script); open (DATA, "$new_script") || die "Error: Couldn't open $new_script : $!\n"; while(<DATA>) { push @Array, $_; } foreach $_ (@Array) { if ($_ =~ /^\[get/) { $_ = join("", $_, "TEST"); print $_; } }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Need RegEx assistance
by dws (Chancellor) on Jul 12, 2002 at 19:38 UTC | |
|
Re: Need RegEx assistance
by jsegal (Friar) on Jul 12, 2002 at 20:43 UTC | |
|
Re: Need RegEx assistance
by jsprat (Curate) on Jul 12, 2002 at 21:01 UTC | |
by Anonymous Monk on Jul 12, 2002 at 21:43 UTC | |
by Anonymous Monk on Jul 12, 2002 at 21:51 UTC | |
by Anonymous Monk on Jul 12, 2002 at 22:05 UTC | |
by Anonymous Monk on Jul 12, 2002 at 22:33 UTC | |
by jsprat (Curate) on Jul 12, 2002 at 22:42 UTC | |
by Anonymous Monk on Jul 12, 2002 at 23:53 UTC | |
|
Re: Need RegEx assistance
by amoura (Initiate) on Jul 12, 2002 at 20:31 UTC |