Search Results

Search: Posts Made By: llcooljatt
6,340
Posted By Just Ice
with some limitations, you can have filenames...
with some limitations, you can have filenames named the same way as your variables if that suits your fancy ... the main thing is that you understand what is in the file just like you would want to...
6,340
Posted By Just Ice
you can name your variables very much any way you...
you can name your variables very much any way you want to (see man sh, man ksh, man bash, etc.) ... however ... it is always good to be able to easily figure out what the variables stand for just by...
6,340
Posted By vgersh99
hope it's clearER. while read llcooljatt ...
hope it's clearER.

while read llcooljatt
do
echo $llcooljatt
done < ip_list
6,340
Posted By Just Ice
dunno if this would be clearer ... # #...
dunno if this would be clearer ...

#
# this is in sh
#

for ip in `cat ip_list`
do
check_GE-VLANStats-P3 $ip
check_GE-VLANStats-P3 $ip
done


to avoid the UUOC condition...
6,340
Posted By vbe
While <condition true>;do;done : In this case...
While <condition true>;do;done : In this case while there is an IP to read from input; do;etc...
the done is executed after the last line given in input (< sign)
This is the standard way to NOT use...
6,340
Posted By vbe
What comment? It is obvious no? Or what don't...
What comment?
It is obvious no?
Or what don't you understand?
6,340
Posted By ahamed101
Why don't you try executing the code and see? ...
Why don't you try executing the code and see?
$ip here will have values 1.1.1.1 2.2.2.2 etc depending on the contents of the file ip_list!

--ahamed
6,340
Posted By ahamed101
while read ip do check_GE-VLANStats-P3 $ip ...
while read ip
do
check_GE-VLANStats-P3 $ip
check_GE-VLANStats-P3 $ip
done < ip_list


--ahamed
6,340
Posted By ahamed101
That is a simple while loop. It reads each line...
That is a simple while loop. It reads each line from the file ip_list into the variable ip. And within the loop, it is being echo-ed here. You missed the do and echo.

And regarding you second...
6,340
Posted By ahamed101
while read ip do check_GE-VLANStats-P3 $ip ...
while read ip
do
check_GE-VLANStats-P3 $ip
done < ip_list


I didn't understand your second point

--ahamed
6,340
Posted By ahamed101
mmm... Try this... IPLIST="1.1.1.1 1.1.1.2" ...
mmm... Try this...

IPLIST="1.1.1.1 1.1.1.2"
for ip in $IPLIST
do
check_GE-VLANStats-P3 $ip
done
--ahamed
6,340
Posted By ahamed101
Use the full path of ssh in that case ret=$(...
Use the full path of ssh in that case

ret=$( /usr/local/bin/ssh $ip /opt/tools/utils/HUB/GEW-VLANStats-P3 )
Please make sure the variable IPLIST is populated correctly with the required IP...
6,340
Posted By ahamed101
If you have ssh enabled, try this... ...
If you have ssh enabled, try this...


IPLIST="192.168.1.1 192.168.1.2"
for ip in $IPLIST
do
ret=$( ssh $ip /full/path/to/script )
echo $ret
done


How to setup SSH, please search the...
6,340
Posted By ahamed101
You don't have ssh? :eek: Paste the output of...
You don't have ssh? :eek:
Paste the output of which ssh

--ahamed
3,365
Posted By ygemici
hmm ok i missed it.:rolleyes: then...
hmm ok i missed it.:rolleyes:



then final version (added to new file to old files)
# awk -F, 'NR==FNR{a[$1FS$2FS$3]++;next}{b[$1FS$2FS$3]++}
END{for(i in b){if(a[i]==b[i]){print...
3,365
Posted By ahamed101
@ygemici : the file arguments which is fed to awk...
@ygemici : the file arguments which is fed to awk is to be noted. 20111229.csv *.csv

20111229.csv is fed in twice and hence it takes care of both new and old with the logic.

--ahamed
3,365
Posted By ygemici
nawk -F, ## determine the our FS=, ...
nawk -F, ## determine the our FS=,
'NR==FNR{a[$1FS$2FS$3]++;next} ## execute this until the NR equal to FNR
so NR means number of input records and it will be increase as long as tha read new...
3,365
Posted By ygemici
i don't understand exactly what you want but i...
i don't understand exactly what you want but i guess output should not contain counts which in the new file about old records..

for example
# cat old*
NE:221726,SHELF:8,SLOT:1,01:00:02,Wed Dec...
3,365
Posted By ahamed101
nawk -F, 'NR==FNR{a[$1OFS$2OFS$3]++;next}...
nawk -F, 'NR==FNR{a[$1OFS$2OFS$3]++;next} a[$1OFS$2OFS$3]{b[$1OFS$2OFS$3]++}
END{for(i in b){if(b[i]-1&&a[i]!=b[i]){print i";\t\t"b[i]}else{print "NEW:"i";\t\t"b[i]} } }' OFS=, 20111229.csv *.csv
...
3,365
Posted By ygemici
then try like this # nawk -F,...
then try like this
# nawk -F, 'NR==FNR{a[$1OFS$2OFS$3]++;next}{b[$1OFS$2OFS$3]++}
END{for(j in b){bx++};for(i in a){for(j in b){if(i==j){cc=a[i]+b[j]}else{cn++}
if(cn==bx){print "NEW ENTRY FOUND...
3,365
Posted By ygemici
maybe you can try like this [ as far as i...
maybe you can try like this [ as far as i understand what you want ]
# awk -F, 'NR==FNR{a[$1OFS$2OFS$3]++;next}{b[$1OFS$2OFS$3]++}
END{for(i in a){for(j in b){if(i==j){cc=a[i]+b[j]}else{cn++};...
3,365
Posted By birei
When you run that piece of code, what is the...
When you run that piece of code, what is the result? Any error?

Regards,
Birei
3,365
Posted By birei
I don't like much your approach to the problem....
I don't like much your approach to the problem. It is difficult to understand, and more if I can't test it.

This is my shot in the dark:

nawk -F, '
NR==FNR {
a[$1OFS$2OFS$3]++;
next...
3,365
Posted By birei
What does this mean? Regards, Birei
What does this mean?

Regards,
Birei
4,949
Posted By ahamed101
echo 20111125.csv; nawk -F,...
echo 20111125.csv; nawk -F, 'NR==FNR{a[$1OFS$2OFS$3]++;next} a[$1OFS$2OFS$3]{b[$1OFS$2OFS$3]++}
END{for(i in b){if(b[i]-1){print i"\t\t"b[i]}else{print "NEW :"i} } }' OFS=, 20111125.csv *.csv | sort...
Showing results 1 to 25 of 52

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