07-30-2011
Perl - how to put to the next line if I have same pattern in one line
Dear All,
Could you help me how to put to the next line if I have pattern below in Perl language.
Data-123 Linux MacOSData-124 windows FreeBSDData-125 OpenBSD NetBSD
I would the output below:
Data-123 Linux MacOS
Data-124 windows FreeBSD
Data-125 OpenBSD NetBSD
Thank you very much
Askari
Last edited by askari; 07-30-2011 at 08:58 AM..
10 More Discussions You Might Find Interesting
1. Shell Programming and Scripting
Hi
I need a perl onliner which seaches a line starting with a pattern(last occurence) and display it.
similar to
grep 'pattern' filename | tail -1 in UNIX
Ex: I want to display the line starting with "cool" and which is a last occurence
adadfadafadf
adfadadf
cool dfadfadfadfara... (4 Replies)
Discussion started by: ammu
4 Replies
2. UNIX for Dummies Questions & Answers
I have a file that will sometimes contain a pattern. The pattern is this:
W/D FRM CHK 00
I want to find any lines with this pattern, delete those lines, and also delete the line above and the line below. (1 Reply)
Discussion started by: nickg
1 Replies
3. Shell Programming and Scripting
I have a file that will sometimes contain a pattern. The pattern is this:
FRM CHK 0000
I want to find any lines with this pattern, delete those lines, and also delete the line above and the line below. (4 Replies)
Discussion started by: nickg
4 Replies
4. Shell Programming and Scripting
#!/usr/bin/perl
use Shell;
open THEFILE, "C:\galileo_integration.txt" || die "Couldnt open the file!";
@wholeThing = <THEFILE>;
close THEFILE;
foreach $line (@wholeThing){
if ($line =~ m/\\0$/){
@nextThing = $line;
if ($line =~ s/\\0/\\LATEST/g){
@otherThing =... (2 Replies)
Discussion started by: nmattam
2 Replies
5. Shell Programming and Scripting
Hi friends, I want to search for some hex error codes in some files.
After the hex error code is found, the occurences would be counted.
Afterwards the found hex errorcode would be cat into a separate file.
Here is my code:
#!/usr/bin/perl
use File::Basename;
my $find = $ARGV;
my... (2 Replies)
Discussion started by: sdohn
2 Replies
6. Shell Programming and Scripting
Hi Folks,
I am new to ksh, i have informatica parameter file that i need to update everyday with shell script. i need your help updating this file with new parameters.
sample data
$$TABLE1_DATE=04-27-2011
$$TABLE2_DATE=04-23-2011
$$TABLE3_DATE=03-19-2011
.......Highligned... (4 Replies)
Discussion started by: victor369
4 Replies
7. Shell Programming and Scripting
Hi,
I have got the below requirement. please suggest.
I have a file like,
Processing Item is:
/data/ing/cfg2/abc.txt
/data/ing/cfg3/bgc.txt
Processing Item is:
/data/cmd/for2/ght.txt
/data/kernal/config.klgt.txt
I want to process the above file to get the output file like,
... (5 Replies)
Discussion started by: rbalaj16
5 Replies
8. Shell Programming and Scripting
Hi,
I have log like this:
... (1 Reply)
Discussion started by: justbow
1 Replies
9. Shell Programming and Scripting
I am trying to combine lines with these conditions:
1. First line starts with text of "libname VALUE db2 datasrc" where VALUE can be any text.
2. If condition1 is met then continue to combine lines through a line that ends with a semicolon.
3. Ignore case when matching patterns and remove any... (5 Replies)
Discussion started by: Wes Kem
5 Replies
10. UNIX for Beginners Questions & Answers
Input file:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18 (6 Replies)
Discussion started by: Sagar Singh
6 Replies
LEARN ABOUT DEBIAN
chart::clicker::data::marker
Chart::Clicker::Data::Marker(3pm) User Contributed Perl Documentation Chart::Clicker::Data::Marker(3pm)
NAME
Chart::Clicker::Data::Marker - Highlight arbitrary value(s)
VERSION
version 2.83
SYNOPSIS
use Chart::Clicker::Data::Marker;
use Graphics::Color::RGB;
use Graphics::Primitive::Brush;
my $cc = Chart::Clicker->new;
my $mark = Chart::Clicker::Data::Marker->new(
color => Graphics::Color::RGB->new,
brush => Graphics::Primitive::Brush->new,
key => 12,
value => 123,
# Optionally
key2 => 13,
value => 146
);
my $ctx = $cc->get_context('default');
$ctx->add_marker($mark);
$cc->write_output('foo.png');
DESCRIPTION
Used to highlight a particular key, value or range of either.
value2
Set/Get the value2 for this marker. This represents a second point on the range and is used to specify a range.
ATTRIBUTES
brush
Set/Get the brush for this Marker.
color
Set/Get the color for this marker.
inside_color
Set/Get the inside color, which will be used if this range has two keys and two values.
key
Set/Get the key for this marker. This represents a point on the domain.
key2
Set/Get the key2 for this marker. This represents a second point on the domain and is used to specify a range.
value
Set/Get the value for this marker. This represents a point on the range.
AUTHOR
Cory G Watson <gphat@cpan.org>
COPYRIGHT AND LICENSE
This software is copyright (c) 2012 by Cold Hard Code, LLC.
This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.
perl v5.14.2 2012-06-22 Chart::Clicker::Data::Marker(3pm)