Search Results

Search: Posts Made By: flyfisherman
2,293
Posted By bartus11
Perl approach: #!/usr/bin/perl use strict; ...
Perl approach:
#!/usr/bin/perl
use strict;
use warnings;

open my $input, "<", "$ARGV[0]" or die "cannot open file: $ARGV[0]";

my %ranges;
while (my $line = <$input>) {
next if $. == 1;
...
2,293
Posted By Akshay Hegde
Add your headers in BEGIN block edit print...
Add your headers in BEGIN block edit print statement, try to learn ... after providing 99.99% of code.. if you can't edit small header information means, what I can tell. Please don't expect others...
2,293
Posted By Yoda
Here is an awk approach: awk ' BEGIN...
Here is an awk approach:
awk '
BEGIN {
print "Algorithm\tPrediction\tLower ragne"
}
function checkIDX(a)
{
n = split ( I[a], T,...
2,281
Posted By disedorgue
Hi, Another way with grep and xargs (as sed...
Hi,
Another way with grep and xargs (as sed Scrutinizer solution):
1) xargs posix:
grep -Ef <(cat file1 | xargs -I {} printf "(^|[[:space:]]){}([[:space:]]|$)\n") file2
2) xargs gnu:
grep -Ef...
2,281
Posted By Scrutinizer
A grep solution might be (if your grep...
A grep solution might be (if your grep understands "-"):
sed 's/^/(^|[[:space:]])/; s/$/([[:space:]]|$)/' file1 | grep -Ef - file2

or (in bash / ksh93 )

grep -Ef <(sed 's/^/(^|[[:space:]])/;...
2,281
Posted By Scrutinizer
Try: awk 'NR==FNR{A[$1]; next} {for(i=1; i<=NF;...
Try:
awk 'NR==FNR{A[$1]; next} {for(i=1; i<=NF; i++) if ($i in A) {print; next}}' file1 file2
Showing results 1 to 6 of 6

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