#!/bin/perl
use strict;
use warnings;
my $LOGFILE = "/path/to/logfile/filename.txt";
open(LOGFILE, $LOGFILE) or die "Could not open log file :$!";
while (<LOGFILE>) {
chomp;
s/\(\d+\)//g; # remove the (n) part
s#/([a-z]{2}=)#:::$1#g; # convert delimiter to :::
my @fields = split(/:::/); #split using new delimiter
print "$_\n" for @fields;
}
close(LOGFILE);
Probably someone better with regexps can write something shorter and possibly more efficient using zero-width look ahead/behind assertions, which I am not too good with.
Hi,
I am stuck with a problem here.
Suppose i have a variable which is assigned some string containing special charatcers. for eg:
$a="abcdef^bbwk#kdbcd@";
I have to remove the special characters using Perl. The text is assigned to the variable implicitly.
How to do it? (1 Reply)
Hi Experts,
In a file tht i copied from the web , i am not able to remove the leading white spaces. I tried the below , none of them working . I opened the file through vi to check for the special characters if any , but no such characters found.
Your advice will be greatly appreciated.
sed... (5 Replies)
Hi all-
I've got a file that will have multiple columns. In one column there will be a string that is 10 digits in length, but I need to trim the first four zeros to make it 6 characters?
example:
0000001234
0000123456
0000234566
0000000321
output:
001234
123456
234566
000321 (5 Replies)
Guys,
can you help me in removing the junk character "^S" from the below line using perl
Reference Data Not Recognised ^S Where a value is provided by the consuming system, which is not reco
Thanks,
M.Mohan (1 Reply)
Hi, I'm writing a ksh script and trying to use an awk / sed / or perl one-liner to remove the last 4 characters of a line in a file if it begins with a period.
Here is the contents of the file... the column in which I want to remove the last 4 characters is the last column. ($6 in awk). I've... (10 Replies)
Hi All,
I am new to Unix and trying to run some scripting on a linux box. I am trying to remove the non alphanumeric characters and alpha characters from the following line.
<measResults>883250 869.898 86432.4 809875.22 804609 60023 59715 </measResults>
Desired output is:
883250... (6 Replies)
I had a string in perl script as below.
Tue Augáá7 03:54:12 2012
Now I need to replace the special character with space.
After removing the special chaacters
Tue Aug 7 03:54:12 2012
Could anyone please help me here for writing the regular expression?
Thanks in advance..
Regards,
GS (1 Reply)
Hello. I've been thinking about how to go about this. I know I'm close but still does not work. I need to remove any word in that is not at least 2 characters long. I've removed all the non-alphabetic characters already (numbers included). Here's an example:
my $string = "This string is a... (4 Replies)
Hello!
I know that this expression gets rid of non-alphanumeric characters:
sed 's///g'
and I understand that it is replacing them with nothing - hence the '//'-, but I don't understand how it's doing it.
It seems it's finding strings that begin with alphanumeric and replacing them with... (2 Replies)
OS : RHEL 6.7
Shell : bash
I am trying to remove the leading the spaces in the below file
$ cat pattern2.txt
hello1
hello2
hello3
hello4
Expected output is shown below.
$ cat pattern2.txt
hello1
hello2
hello3
hello4 (2 Replies)
Discussion started by: John K
2 Replies
LEARN ABOUT DEBIAN
ircd-ratbox
IRCD-RATBOX(8) System Administration Commands IRCD-RATBOX(8)NAME
ircd-ratbox - Advanced, stable and fast ircd
SYNOPSIS
ircd-ratbox [-help | -version]
ircd-ratbox [-basedir BASEDIR] [-configfile CONFFILE] [-logfile LOGFILE] [-pidfile PIDFILE] [-foreground] [-conftest]
DESCRIPTION
ircd-ratbox is the main ircd daemon responsible for running the IRC server. It delegates specific tasks to several other daemons: resolver,
ssld, bandb.
OPTIONS -help
Show summary of options.
-version
Display version information.
-basedir BASEDIR
Before starting the server, enter BASEDIR directory (chdir).
-configfile CONFFILE
Set configuration file (defaults to /etc/ircd-ratbox/ircd.conf).
-logfile LOGFILE
Set main log path (defaults to /var/log/ircd-ratbox/ircd.log).
-pidfile PIDFILE
Set file used to store main daemon PID (defaults to /etc/ircd-ratbox/ircd.pid).
-foreground
Don't detach process in the background.
-conftest
Check configuration and exit.
AUTHOR
Marc `Duck` Dequenes <Duck@DuckCorp.org>
Original author.
COPYRIGHT
Copyright (C) 2011 Marc Dequenes (Duck)
This manual page was written for the Debian system (but may be used by others). Permission is granted to copy, distribute and/or modify
this document under the terms of the GNU General Public License, Version 3 or any later version published by the Free Software Foundation.
On Debian systems, the complete text of the GNU General Public License version 3 can be found in /usr/share/common-licenses/GPL-3.
ircd ratbox 2011-11-07 IRCD-RATBOX(8)