Thanks anyway y'all. I decided to go another direction.
What i did was cat all the individual files together. Once with the complete lines included the other time just the ip's sorted and unique. Then i did a loop reading the ip checking it against my output file to make sure the ip hasn't already been logged. Then if it hasn't, grep the domain (first field) from the full listing file and tailed the last entry (lines with the most IP's associated to the domain). lather, rinse, repeat.
Then i go through the output file and count the colons in each line and write to the respective file based on number of ip's associated to the domains.
Code:
cat ?_servers_ips |sed 's/:/\n/g' |grep -v "^$|[[:alpha:]] |sort -u > master_iplist
cat ?_servers_ips > working_output
for I in {8..1}; do
cat /dev/null > "working_"$i"_ips"
done
while read my IP
do
grep $myIP working_output > /dev/null
if [ $? == 1 ]; then
grep $myIP all_working_ips |tail -1 >> working_output
fi
done < master_iplist
while read testDomain
do
count=`grep -o ":" <<< $testDomain| wc -l`
count=`bc <<< $count-1`
if [ $count -ge 8 ]; then #lump the couple of 8 or more into 1 file
count=8
fi
printf "$testDomain\n" >> "working_"$i"_ips"
done < working_output
Hi all,
I am new to linux and got problem with pthread_mutex_trylock(). I have used mutex in my code. When I try to call pthread_mutex_trylock() on RECURSIVE type of mutex it overwrites adjacent memory location (that is global variable of type structure say x, memory allocated using malloc()). ... (5 Replies)
Hi,
I'm not a expert in shell programming, so i've come here to take help from u gurus.
I'm trying to tailor a csv file that i got to make it work for the LOAD FROM command.
I've a datatable csv of the below format -
--in file format
xx,xx,xx ,xx , , , , ,,xx,
xxxx,, ,, xxx,... (11 Replies)
Hi,
I have one file, say file 1, that has data like below where 19900107 is the date,
19900107 12 144 129 0.7380047
19900108 12 168 129 0.3149017
19900109 12 192 129 3.2766666E-02
... (3 Replies)
Hi!
I've just installed CentOS 5.5 on HP Proliant DL380G5 with two FC HBA and now I'm struggling with adding HP EML103e connected through two Brocade SAN switches. Tape library has two tape drives, each in different fabric. Robotics connected to both fabrics. Zoning is ok - OS sees drives'... (0 Replies)
I have a text file called ( bvhz ) contains data :
Subscriber
Data ID = 2
Customer = 99
Data ID = 4
Customer = cf99
Data ID = 5
Customer = c99
Data ID = 11
Customer = 9n9
Subscriber
Data ID = 1
Customer = 9ds9
Data ID = 2
Customer = 9sad9
Data ID = 3
Customer = f99... (1 Reply)
Hi All,
I was wondering how I can convert each line in an input file where fields are separated by variable width spaces into a CSV file. Below is the scenario what I am looking for.
My Input data in inputfile.txt
19 15657 15685 Sr2dReader 107.88 105.51... (4 Replies)
Hi folks
I have a script I wrote that basically parses a bunch of config and xml files works out were to add in the new content then spits out the data into a new file.
It all works - apart from the xml and config file format in the new file
with XML files the original XML (that ends up in... (2 Replies)
I have a laptop running CentOS 5.9 with switchable/hybrid graphics (Intel integrated and Nvidia). For now, have managed to successfully install Nvidia driver using NVIDIA-Linux-x86_64-331.20.run file from Nvidia website, but failed to start xserver.
To use both adapters I need to install... (0 Replies)
I have been searching and trying to come up with an awk that will perform the following on a
converted text file (original is a pdf).
1. Since the first two lines are (begin with) text they are removed
2. if $1 is a number then all text is merged (combined) into one line until the next... (3 Replies)
The bash below executes and does find all the .bam files in each R_2019 folder. However set -x shows that the .bam extension only gets removed from one .bam file in each folder (appears to be the last in each). Why is it not removing the extension from each (this is $SAMPLE)? Thank you :).
set... (4 Replies)
Discussion started by: cmccabe
4 Replies
LEARN ABOUT MINIX
zgrep
ZGREP(1) General Commands Manual ZGREP(1)NAME
zgrep - search possibly compressed files for a regular expression
SYNOPSIS
zgrep [ grep_options ] [ -e ] pattern filename...
DESCRIPTION
Zgrep invokes grep on compressed or gzipped files. These grep options will cause zgrep to terminate with an error code:
(-[drRzZ]|--di*|--exc*|--inc*|--rec*|--nu*). All other options specified are passed directly to grep. If no file is specified, then the
standard input is decompressed if necessary and fed to grep. Otherwise the given files are uncompressed if necessary and fed to grep.
If the GREP environment variable is set, zgrep uses it as the grep program to be invoked.
EXIT CODE
2 - An option that is not supported was specified.
AUTHOR
Charles Levert (charles@comm.polymtl.ca)
SEE ALSO grep(1), gzexe(1), gzip(1), zdiff(1), zforce(1), zmore(1), znew(1)ZGREP(1)