Search Results

Search: Posts Made By: Skrynesaver
12,515
Posted By Skrynesaver
$ cat ~/tmp.dat Name , Company_Worked (Header) ...
$ cat ~/tmp.dat
Name , Company_Worked (Header)
Asley,IBM;Amazon;BOA;Google
King.Jr,Wipro;Microsoft;AMZ

$ perl -ne 'chomp;($name,$emp)=split/,/;for (split/;/,$emp){print "$name, $_\n";}'...
2,637
Posted By Skrynesaver
So every 10 minutes, check the directory and if...
So every 10 minutes, check the directory and if the most recent file is greater than 10 minutes old send a mail with the subject "No new files seen since ${LATEST_FILE_TIMESTAMP}"

You can use cron...
1,644
Posted By Skrynesaver
That's a shell command ;) I can break it into...
That's a shell command ;) I can break it into digestible chunks if you wish

perl -ne ' #Call the Perl interpreter and iterate over every line in the files listed as arguments with...
1,644
Posted By Skrynesaver
[skrynesaver@busybox]$cat tmp.dat name,id,flag ...
[skrynesaver@busybox]$cat tmp.dat
name,id,flag
apple,1,Y
apple,2,N
mango,1,Y
mango,2,Y
[skrynesaver@busybox]$ perl -ne 'chomp;@r=split/,/; push @{$fields{$r[0]}},$r[1] if $r[2] eq "Y";}{for...
Forum: AIX 08-16-2017
6,654
Posted By Skrynesaver
visudo and add the user or, if you have an...
visudo and add the user or, if you have an administrative group (eg. wheel) add the user to the group with adduser $USERNAME wheel
1,218
Posted By Skrynesaver
hn.rstrip("\n\r") in order to lose the new line...
hn.rstrip("\n\r") in order to lose the new line character
7,585
Posted By Skrynesaver
$ cat test.file 123andsomeothervalues with a...
$ cat test.file
123andsomeothervalues with a space at position 22
Not 123 but with the space
123 but no spacein the appropriate column

$ perl -npi.bak -e 's/^(123.{18}) /$1X/' test.file

$...
7,585
Posted By Skrynesaver
perl -npi.bak -e ' s/(123.{797}) /${1}X/' infile
perl -npi.bak -e ' s/(123.{797}) /${1}X/' infile
1,566
Posted By Skrynesaver
\1 holds the value of the first capture group on...
\1 holds the value of the first capture group on the lhs of a substitution

google sed capture groups for many detailed discussions
1,274
Posted By Skrynesaver
Untested but you get the idea... ls -R...
Untested but you get the idea...

ls -R lib/SBSSchemaProject.jar/schemas/ | perl -ne '($schema,$major,$minor)=$_=~/\/(\w+)_v(\d+)_9\d+).xsd$/;if (($major > $max_major)||(($major ==...
2,898
Posted By Skrynesaver
Hi Pravin, That will work however, while it...
Hi Pravin,

That will work however, while it will use less memory than a hash, it will use a lot more cycles. you are grepping through the (potentially large array) for every line of the file.
...
2,898
Posted By Skrynesaver
Any time you want to quickly check if something...
Any time you want to quickly check if something is in a list, use a hash...

%hash=(val1 => 1, val2 => 1, val3 => 1, val6 => 1, ); # hash with unwanted items as keys and values that evaluate as...
13,125
Posted By Skrynesaver
Test that mailx...
Test that mailx (https://www.unix.com/man-page/opensolaris/1/mailx/) works correctly and then


crontab -e

00,15,30,45 0 0 0 0 [ -x /a/b/c/script.sh ] && /a/b/c/script.sh | grep not | mailx...
2,513
Posted By Skrynesaver
perldoc -f chomp I did mention it was...
perldoc -f chomp


I did mention it was untested
1,310
Posted By Skrynesaver
man wget man diff Download the page, save...
man wget
man diff

Download the page, save it as page.new, compare it to the previous copy, if it has changed they will be different. Do whatever you wish to do with the altered data, move the...
1,833
Posted By Skrynesaver
perl -ne 'print "$1,$2,$3,$4,$5\n" if...
perl -ne 'print "$1,$2,$3,$4,$5\n" if /{"driver":{"first_name":"([^"]+)","last_name":"([^"]+)"},"confirmation_id":"([^"]+)","vendor":{"id":"([^"]+)","name":"([^"]+)"}}/' filename


ASSUMPTIONS,...
785
Posted By Skrynesaver
|| is a shorthand for OR, this is common in many...
|| is a shorthand for OR, this is common in many C-like languages (or even algol descendants), so if the shift returns false (no element in the default array) the value of $self is set to 7899
1,362
Posted By Skrynesaver
Actually, Perl regexen have the concept of...
Actually, Perl regexen have the concept of reluctant quantifiers, thus /<.*>/ will match all of <img src="https://www.unix.com/images/next.gif" alt="Next>"> whereas /<.*?>/ will match <img...
2,690
Posted By Skrynesaver
Which database client? Can we see the shell...
Which database client?
Can we see the shell script?
How are you sending the mail?
Is there a column format specifier in place?

Actually no need for that info, I see the problem now, you...
1,664
Posted By Skrynesaver
Regex is not really suited to parsing HTML, you...
Regex is not really suited to parsing HTML, you should consider using a Perl module such as XML::Simple.

that said, you want a sed script that will strip everything within the angle brackets <...>...
1,380
Posted By Skrynesaver
A Perl solution perl -ne 'BEGIN{open $refs...
A Perl solution

perl -ne 'BEGIN{open $refs ,"<","target.txt";@refs=<$refs>;chomp(@refs);$regex=join"|",@refs;}
@r=split/\s+/,$_;if ($r[4]=~/^$regex$/ ){$next = readline; @n=split/\s+/,$next;print...
1,119
Posted By Skrynesaver
No, you need a list of files with the word house...
No, you need a list of files with the word house in them rather than the "normal" grep output, also you need to provide the filenames as arguments to the tar command...

tar -cvf test.tar $(grep -l...
1,171
Posted By Skrynesaver
While I must learn AWK "one of these days...
While I must learn AWK "one of these days soon"(TM) the following Perl solution does the job required.

skrynesaver@busybox ~/$ cat tmp/tmp.pl
#!/usr/bin/perl
use strict;
open (my...
1,378
Posted By Skrynesaver
No offence but I haven't looked at VB in over 20...
No offence but I haven't looked at VB in over 20 years, have never written Office mcros, and have no desire to start now...

Could you describe your requirements in English rather than with...
789
Posted By Skrynesaver
One approach would be to change to the azzure...
One approach would be to change to the azzure directory, check if each entry matching a glob is a file and if it is move it into the recent directory

cd azzure/files
for file in ./* ; do
if [...
Showing results 1 to 25 of 215

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