Sponsored Content
Top Forums Shell Programming and Scripting How to delete newline with perl Post 302462717 by cola on Thursday 14th of October 2010 11:32:23 PM
Old 10-15-2010
Debian How to delete newline with perl

input:
Code:
donkey

monkey


dance


drink

output should be:
Code:
donkey
monkey
dance
drink

 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Perl delete an element from array

Probably I am not seeing it or I am not using the "delete" correctly I had the following codes but it does not work for me #!/bin/perl -w ... @sysFile1 = (a_b, a_c, a_d); @sysFile2 = (a_c, a_e, b_f); foreach $line1 (@sysFile1){ trim(\$line1); (my $tmp1, my $tmp2) = split/_/,... (6 Replies)
Discussion started by: ahtat99
6 Replies

2. UNIX for Dummies Questions & Answers

delete newline character between html tags

Hi, I have learned some of the Unix commands a way back and not sure of how to code them when needed in certain way, especially sed command. Here is my situation. I have an xml file with several tags. most of the tags start on the same line and end on the same line. However, data for some tags... (8 Replies)
Discussion started by: girish312
8 Replies

3. UNIX for Dummies Questions & Answers

Delete the line started with nondigit or newline character

i want to delete the line which is not started with numeric in vim. vim temp.txt Volume in drive D is DATA Volume Serial Number is 8C52-2055 Directory of D:\data\notes 02/16/2010 03:09 PM <DIR> . 02/16/2010 03:09 PM <DIR> .. 09/11/1999 03:03 AM ... (5 Replies)
Discussion started by: Manabhanjan
5 Replies

4. Shell Programming and Scripting

delete last row in PERL

How to delete last row in the file in PERL. file1 has a.output b.output c.output d.output e.output expected output is a.output b.output c.output d.output (1 Reply)
Discussion started by: adaleru
1 Replies

5. Shell Programming and Scripting

delete a file using perl

Hi, How to delete a file (if exists) using perl script. I have used following script.. if ( -e $newfile) { open (FILE, ">$newfile") || die "Cannot Open File\n"; print FILE; close(FILE); } But it gives me error "Use of uninitialized value in print". please help. Thanks in... (1 Reply)
Discussion started by: arup1980
1 Replies

6. Shell Programming and Scripting

Delete files in directory using perl

Hello All I am implementing my task in Perl and i found an issue. What i want to do is to remove files from the directory which were made 20 days back using Perl script (9 Replies)
Discussion started by: parthmittal2007
9 Replies

7. Shell Programming and Scripting

Delete lines in an array Using perl

im having an array @check which contains text ..i want to open the array and i have to delete lines starting from a word called "check1" till "check2" for eg:- check1 Use descriptive titles when posting. For example, do not post questions with subjects like "Help Me!", "Urgent!!" or "Doubt".... (0 Replies)
Discussion started by: rajkrishna89
0 Replies

8. Shell Programming and Scripting

Delete line - Perl one liner

Hi all, I need a Perl one liner which prints a newline into a .txt file, only where the line starts with "/mediawiki-1.19.0/". It should add the newline to the line before. My problem is, when I try to realize this (with my little knowledge :rolleyes: ) i come to the point where the // are... (4 Replies)
Discussion started by: Mr.Smith
4 Replies

9. Shell Programming and Scripting

awk delete newline after other replacements

Dear All, could you please help me to remove \n characters after all other replacements have been done as in the code below: { #remove punctuation and starting whitespaces gsub("]"," "); $1=$1; } { #print lines containing 'whatever' if ($1=="whatever") {print} #print... (3 Replies)
Discussion started by: shivacoder
3 Replies

10. Shell Programming and Scripting

Perl : Delete all files except few

I have a directory like below. Need help with Perl to delete all files under test1 except the one passed as parameters.The parameters will always be the directories under test1 in the format below. EX: dir1/abc.txt,dir2/test.xml,dir3/dfb.txt,dir4/text.xml test1 ... (5 Replies)
Discussion started by: gaurav99
5 Replies
POE::Component::IRC::Plugin::BotAddressed(3pm)		User Contributed Perl Documentation	    POE::Component::IRC::Plugin::BotAddressed(3pm)

NAME
POE::Component::IRC::Plugin::BotAddressed - A PoCo-IRC plugin that generates events when you are addressed SYNOPSIS
use POE::Component::IRC::Plugin::BotAddressed; $irc->plugin_add( 'BotAddressed', POE::Component::IRC::Plugin::BotAddressed->new() ); sub irc_bot_addressed { my ($kernel, $heap) = @_[KERNEL, HEAP]; my $nick = ( split /!/, $_[ARG0] )[0]; my $channel = $_[ARG1]->[0]; my $what = $_[ARG2]; print "$nick addressed me in channel $channel with the message '$what' "; } sub irc_bot_mentioned { my ($nick) = ( split /!/, $_[ARG0] )[0]; my ($channel) = $_[ARG1]->[0]; my ($what) = $_[ARG2]; print "$nick mentioned my name in channel $channel with the message '$what' "; } DESCRIPTION
POE::Component::IRC::Plugin::BotAddressed is a POE::Component::IRC plugin. It watches for public channel traffic (i.e. "irc_public" and "irc_ctcp_action") and will generate an "irc_bot_addressed", "irc_bot_mentioned" or "irc_bot_mentioned_action" event if its name comes up in channel discussion. METHODS
"new" One optional argument: 'eat', set to true to make the plugin eat the "irc_public" / "irc_ctcp_action" event and only generate an appropriate event, default is false. Returns a plugin object suitable for feeding to POE::Component::IRC's "plugin_add" method. OUTPUT EVENTS
"irc_bot_addressed" Has the same parameters passed as "irc_ctcp_public". "ARG2" contains the message with the addressed nickname removed, ie. Assuming that your bot is called LameBOT, and someone says 'LameBOT: dance for me', you will actually get 'dance for me'. "irc_bot_mentioned" Has the same parameters passed as "irc_public". "irc_bot_mentioned_action" Has the same parameters passed as "irc_ctcp_action". AUTHOR
Chris 'BinGOs' Williams <chris@bingosnet.co.uk> perl v5.14.2 2011-12-07 POE::Component::IRC::Plugin::BotAddressed(3pm)
All times are GMT -4. The time now is 09:41 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy