Search Results

Search: Posts Made By: durden_tyler
1,759
Posted By durden_tyler
Using Perl only for determining line counts just...
Using Perl only for determining line counts just does not seem to be an efficient way of doing things.
You will have more points of failure in your script. Also, more code means more to...
6,284
Posted By durden_tyler
I am not familiar with scl but by looking at the...
I am not familiar with scl but by looking at the "QuickStart" page of the "softwarecollections.org" website, it might be mandatory to specify "bash" at the end of that "scl" command(?)


scl...
3,078
Posted By durden_tyler
That's because you are using a regular expression...
That's because you are using a regular expression for FS that works differently than you (probably) think it does.
This part:[^,]* matches "0 or more occurrences of a character other than comma"....
3,922
Posted By durden_tyler
A very un-awk-like and more Perl-like script. :) ...
A very un-awk-like and more Perl-like script. :)

I added the sort routine because array iteration doesn't return the elements in order.
(Definitely not a good idea for large arrays.)

Note that...
3,218
Posted By durden_tyler
If Perl is an option, then here's a sample...
If Perl is an option, then here's a sample program:



$
$ cat -n process_files.pl
1 #!/usr/bin/perl
2 use strict;
3
4 # Set the file names
5 my $search_file =...
Forum: Programming 01-03-2019
2,624
Posted By durden_tyler
First of all - thank you very much for providing...
First of all - thank you very much for providing the CREATE TABLE and INSERT statements. Those really help!
If you have MySQL version < 8.0.2, then you could find the previous level by joining the...
4,563
Posted By durden_tyler
As per the documentation of this module at:...
As per the documentation of this module at: https://metacpan.org/pod/Spreadsheet::WriteExcel#set_row($row,-$height,-$format,-$hidden,-$level,-$collapsed)
I guess you could probably do something like...
Forum: Programming 08-27-2018
1,106
Posted By durden_tyler
Not sure if I understood the "o/p values are...
Not sure if I understood the "o/p values are dynamic" part, but see if this helps:


SQL>
SQL> SELECT * FROM mytable;

A B STATUS
---------- ---------- ----------
Insert ...
Forum: Programming 08-27-2018
2,000
Posted By durden_tyler
What you want are the "rank()" or "dense_rank()"...
What you want are the "rank()" or "dense_rank()" analytic functions.
They could be referred to as "window functions" or "OLAP functions" in DB2 and some of them are available in DB2 9.7 at least....
1,767
Posted By durden_tyler
It's actually working correctly. The !~...
It's actually working correctly.
The !~ operator returns true if the pattern match fails.
The =~ operator returns true if the pattern match succeeds.

You may want to take note that the !...
Forum: Programming 05-05-2018
57,415
Posted By durden_tyler
The following was tested on DB2 Express-C Version...
The following was tested on DB2 Express-C Version 11.1 on a Centos 7 Virtual Machine.


[db2inst1@r2d2-centos7 data]$
[db2inst1@r2d2-centos7 data]$ cat -n dec2bin.sql
1 --
2 ...
1,157
Posted By durden_tyler
$ $ echo...
$
$ echo PO_CREATE12457888888888889SK1234567878744551111111111SK89456321145789955455555SK8888888815788852222 | perl -lne 'while (/(SK.{8})/g){print $1}'
SK12345678
SK89456321
SK88888888
$
$
1,229
Posted By durden_tyler
Upon searching about this topic in the Internet,...
Upon searching about this topic in the Internet, I found that the "read" command may be unable to read a line that is not terminated by a newline.
However, I could not test it in my Cygwin Bash on...
2,125
Posted By durden_tyler
One way to do it would be to keep appending and...
One way to do it would be to keep appending and "building" two different strings - one for all users and the other for all user role assignments inside the while loop.
Once you're done with the...
1,565
Posted By durden_tyler
$ $ cat hello.out 18026/1: 10.877406...
$
$ cat hello.out
18026/1: 10.877406 lseek(10, 1480, SEEK_SET) = 1480
18026/1: 10.877623 fstat(1, 0xFFFFFFFF7FFFE840) = 0
18026/1: 10.877905 _exit(0)
18026/1: 10877623 fstat(1,...
1,270
Posted By durden_tyler
What if the date in the file name falls on a...
What if the date in the file name falls on a Tuesday itself? (e.g. "FILE_NAME_20180417")
I assume, in that case, you want the same date returned, rather than the previous week's Tuesday.

Using...
Forum: Programming 02-24-2018
7,876
Posted By durden_tyler
$ $ cat -n col_to_row.sql 1 connect...
$
$ cat -n col_to_row.sql
1 connect to sample;
2 drop table t_data;
3 create table t_data(col_1 varchar(20), col_2 varchar(20));
4 insert into t_data (col_1,...
5,281
Posted By durden_tyler
That's because you changed your delimiter...
That's because you changed your delimiter character from ";" to "," (semi-colon to comma) in the last line of your data file.

If I keep the delimiter consistent for all the rows i.e. ";", then it...
5,281
Posted By durden_tyler
The Perl script will not work either because the...
The Perl script will not work either because the numeric part of the header columns moved to the left of the underscore ("_") instead of the right.

So, the index to compare after the "split"...
5,281
Posted By durden_tyler
If Perl is an option, then one way could be: ...
If Perl is an option, then one way could be:


$
$ cat input.txt
a_13;a_2;a_1;a_10
13;2;1;10
$
$
$ perl -F';' -lane 'if ($. == 1){
%x = map{ $F[$_] => $_ } (0..$#F);...
7,216
Posted By durden_tyler
In a Perl program, you'd accept the input log...
In a Perl program, you'd accept the input log file name (if so desired), open it, loop/process through it and then close it.
Here's a short program called "process_log.pl".
Hopefully the inline...
7,216
Posted By durden_tyler
If the 8-digit number is always preceded by the...
If the 8-digit number is always preceded by the word "STATE:" then you could use regular expressions as well:


$
$ cat mylog.txt
01/05/2017 10:23:41 [ABCD-22357$0]: file.log.38: database error,...
2,566
Posted By durden_tyler
Add an "order by" clause to your query and that...
Add an "order by" clause to your query and that should sort the data the way you want.
2,273
Posted By durden_tyler
Yes, from your other Perl related posts, I do get...
Yes, from your other Perl related posts, I do get the impression that you are trying to use the regexes for too many things. That should be avoided.
However, for this particular piece of code, I...
4,006
Posted By durden_tyler
Thank you for testing it for various inputs and...
Thank you for testing it for various inputs and posting the Perl version.
I could not find a working Perl 5.10 version to test it, so am unable to reproduce the bug.
However, after searching on...
Showing results 1 to 25 of 500

 
All times are GMT -4. The time now is 01:25 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy