Visit Our UNIX and Linux User Community

Search Results

Search: Posts Made By: Skrynesaver
2,823
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";}'...
487
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...
700
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...
700
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
2,535
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
688
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
3,256
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

$...
3,256
Posted By Skrynesaver
perl -npi.bak -e ' s/(123.{797}) /${1}X/' infile
perl -npi.bak -e ' s/(123.{797}) /${1}X/' infile
782
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
749
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 ==...
1,687
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.
...
1,687
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...
2,504
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...
1,494
Posted By Skrynesaver
perldoc -f chomp I did mention it was...
perldoc -f chomp


I did mention it was untested
915
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,221
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,...
596
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
869
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...
1,375
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,122
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,030
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...
739
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...
762
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...
739
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...
586
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

 

Featured Tech Videos

All times are GMT -4. The time now is 11:55 PM.
Unix & Linux Forums Content Copyright 1993-2020. All Rights Reserved.
Privacy Policy