I'm working on a basic log parser in perl. Input file looks like:
Of course there are tens of thousands of lines... I'm trying to compare the len and filesize values.
$size =~ s/\d+$// does exactly the opposite of what I want. I tried using !~ but that didn't return anything.
Tips?
Many thanks.
---------- Post updated at 05:23 PM ---------- Previous update was at 04:51 PM ----------
Found a working solution. It seems strange to have to use the if statements given that I know that the result is there.
Is there a way to simply directly assign it without the If statement?
Hi,
Can anyone help me to find regular expression for the following in Perl?
"The string can only contain lower case letters (a-z) and no more than one of any letter."
For example: "table" is accepted, whether "dude" is not.
I have coded like this:
$str = "table";
if ($str =~ m/\b()\b/) {... (4 Replies)
Hi Guys,
In the following line:
cn=portal.090710.191533.428571000,cn=groups,dc=mp,dc=rj,dc=gov,dc=br
I need to extract this string: portal.090710.191533.428571000
As you can see this string always will be bettween "cn=" and "," strings.
Someone know one regular expression to... (4 Replies)
My input contains a single word lines.
From each line
data.txt
prjtestBlaBlatestBlaBla
prjthisBlaBlathisBlaBla
prjthatBlaBladpthatBlaBla
prjgoodBlaBladpgoodBlaBla
prjgood1BlaBla123dpgood1BlaBla123
Desired output -->
data_out.txt
prjtestBlaBla
prjthisBlaBla... (8 Replies)
I am having trouble parsing rpm filenames in a shell script.. I found a snippet of perl code that will perform the task but I really don't have time to rewrite the entire script in perl. I cannot for the life of me convert this code into something sed-friendly:
if ($rpm =~ /(*)-(*)-(*)\.(.*)/)... (1 Reply)
Hi,
I've a logfile which i need to parse and get the logs depending upon the user input. here, i'm providing an option to enter the string which can be matched with the log entries.
e.g. one of the logfile entry reads like this -
$str = " mpgw(BLUESOAPFramework):... (6 Replies)
i have a script in which i need to skip comments, and i am able to achieve it partially...
IN text file:
{****************************
{test : test...test }
Script:
while (<$fh>)
{
push ( @data, $_);
}
if ( $data =~ m/(^{\*+$)/ ){
}
With the above match i am... (5 Replies)
HI,
I'm new to perl and need simple regex for reading a file using my perl script.
The text file reads as -
filename=/pot/uio/current/myremificates.txt
certificates=/pot/uio/current/userdir/conf/user/gamma/settings/security/... (3 Replies)
Hello folks,
Looking for a quick help on regex in my perl script.
here's the string i want to parse and get the 2nd field out of it.
$str = " 2013-08-07 12:29 Beta ACTIVE";
I want to extract 'Beta' out of this string. This string will keep on changing... (2 Replies)
I am not a big expert in regex and have just little understanding of that language.
Could you help me to understand the regular Perl expression:
^(?!if\b|else\b|while\b|)(?:+?\s+){1,6}(+\s*)\(*\) *?(?:^*;?+){0,10}\{
------
This is regex to select functions from a C/C++ source and defined in... (2 Replies)
Hi,
I need some guidance with understanding this Perl script below. I am not the author of the script and the author has not leave any documentation. I supposed it is meant to be 'easy' if you're a Perl or regex guru. I am having problem understanding what regex to use :confused: The script does... (3 Replies)
Discussion started by: newbie_01
3 Replies
LEARN ABOUT DEBIAN
zip_set_file_extra
ZIP_SET_FILE_EXTRA(3) Library Functions Manual ZIP_SET_FILE_EXTRA(3)NAME
zip_set_file_extra - set extra field for file in zip
LIBRARY
libzip (-lzip)
SYNOPSIS
#include <zip.h>
int zip_set_file_extra(struct zip *archive, zip_uint64_t index); "const char *extra" "int len"
DESCRIPTION
The zip_set_file_extra function sets the extra field for the file at position index in the zip archive to extra of length len. If extra is
NULL and len is 0, the file extra field will be removed.
RETURN VALUES
Upon successful completion 0 is returned. Otherwise, -1 is returned and the error information in archive is set to indicate the error.
ERRORS
zip_set_file_extra fails if:
[ZIP_ER_INVAL]
index is not a valid file index in archive, or len is less than 0 or longer than the maximum extra field length in a zip file
(65535).
[ZIP_ER_MEMORY]
Required memory could not be allocated.
SEE ALSO libzip(3), zip_get_file_extra(3)AUTHORS
Dieter Baron <dillo@giga.or.at> and Thomas Klausner <tk@giga.or.at>
NiH February 13, 2011 ZIP_SET_FILE_EXTRA(3)