Navigacija
Lista poslednjih: 16, 32, 64, 128 poruka.

Kako ovo izvesti?

[es] :: Skript jezici :: Kako ovo izvesti?

[ Pregleda: 10685 | Odgovora: 2 ] > FB > Twit

Postavi temu Odgovori

Autor

Pretraga teme: Traži
Markiranje Štampanje RSS

Machiavelli...
Đorđe Đokanović
IT Support Engineer II
www.amazon.com
Philadelphia

Član broj: 90589
Poruke: 672
*.amazon.com.

Sajt: www.linkedin.com/in/dorde..


+92 Profil

icon Kako ovo izvesti?24.03.2014. u 21:16 - pre 121 meseci
Pozdrav, imam jedan problem i nisam siguran kako da ga resim... Evo o cemu je rec imam 2 file-a

file1.txt
Internet 10.67.186.189 0 0040.580b.7684 ARPA
Internet 10.67.185.141 0 0040.580b.757c ARPA
Internet 10.67.185.243 1 0040.580b.a53a ARPA
Internet 10.67.187.142 0 0040.580b.75b0 ARPA
Internet 10.67.186.101 0 0040.580b.7616 ARPA
Internet 10.67.186.224 0 0040.580b.a3e9 ARPA
Internet 10.67.187.147 0 0040.580b.7697 ARPA
Internet 10.67.187.83 0 0040.580b.7769 ARPA
Internet 10.67.187.176 0 0040.580b.76cf ARPA
Internet 10.67.186.165 0 0040.580b.7733 ARPA
Internet 10.67.186.245 0 0040.580b.763d ARPA
Internet 10.67.186.230 0 0040.580b.9aef ARPA
Internet 10.67.186.206 0 0040.580b.a5b5 ARPA
Internet 10.67.186.238 0 0040.580b.76fe ARPA
Internet 10.67.187.144 0 0040.580b.7470 ARPA
Internet 10.67.187.201 0 0040.580b.7639 ARPA
Internet 10.67.187.223 0 0040.580b.a678 ARPA
Internet 10.67.186.243 0 0040.580b.9bfe ARPA
Internet 10.67.185.107 0 0040.580b.a420 ARPA
Internet 10.67.187.135 0 0040.580b.7652 ARPA
Internet 10.67.187.112 0 0040.580b.775a ARPA
Internet 10.67.187.249 0 0040.580b.a63e ARPA
Internet 10.67.186.107 0 0040.580b.767a ARPA

file2.txt

0040.580b.7684#aaaa
0040.580b.757c#bbbb
0040.580b.a53a#cccc
0040.580b.75b0#dddd
0040.580b.aa58#eeee
0040.580b.7616#ffff
0040.580b.a3e9#gggg
0040.580b.7697#hhhh
0040.580b.7769#iiii
0040.580b.76cf#jjjj
0040.580b.7733#kkk
0040.580b.763d#llll
0040.580b.9aef#mmmm
0040.580b.a5b5#nnnn
0040.580b.76fe#oooo
0040.580b.7470#pppp
0040.580b.7639#qqqq
0040.580b.a678#rrrr
0040.580b.9bfe#ssss
0040.580b.a420#tttt
0040.580b.7652#uuuu
0040.580b.775a#vvvv
0040.580b.a63e#wwww
0040.580b.767a#xxxx
0040.580b.746f#yyyy
0040.580b.75a7#zzzz
0040.580b.7722#asdf
0040.580b.7607#dfgh
0040.580b.7689#hjkl
0040.580b.74c2#ghjk
0040.580b.73ac#dfty

Script mi generise file1.txt i on se ponekad menja u zavisnosti od toga da li je timeclock skinut sa mreze ili nesto slicno, file2.txt se ne menja i samo povezuje lokaciju sa mac adresom timeclock-a. Meni je potrebno napravim file3.txt sledeceg formata

file3.txt
10.67.186.189:aaa
10.67.185.141:bbb
...

Odnosno da iz prvog file izvucem IP a umesto mac adrese u toj istoj liniji uzmem opis iz file2.txt i kreiram file3.txt



Having an idea is like being in a nutshell, but exchanging idea and collaborate
with
others is like being in infinite ocean of knowledge.
________________________________________________________________
____

Veruj u sebe. Ako ti neces, ko hoce?!

„Bolje živeti 100 godina kao milioner, nego sedam dana u bedi.“
 
Odgovor na temu

jablan

Član broj: 8286
Poruke: 4541



+710 Profil

icon Re: Kako ovo izvesti?24.03.2014. u 22:13 - pre 121 meseci
script.awk

Code:
BEGIN {
  FS=" ";
  while (getline < "file1.txt") { addrs[$4]=$2 };
  FS="#";
  OFS="#";
}
$1 in addrs {
  print addrs[$1], $2
}


startuješ sa:

Code:
awk -f script.awk file2.txt > file3.txt
 
Odgovor na temu

Machiavelli...
Đorđe Đokanović
IT Support Engineer II
www.amazon.com
Philadelphia

Član broj: 90589
Poruke: 672
*.amazon.com.

Sajt: www.linkedin.com/in/dorde..


+92 Profil

icon Re: Kako ovo izvesti?24.03.2014. u 22:22 - pre 121 meseci
Radi! Hvala mnogo.. Samo da znas sta sdam ja pokusavao... Radio for loop i onda izdvajao za svaku iteraciju ip i mac, kreirao privremeni file pa onda menjao mac sa lokacijom :-)

Ovo je bas sto mi je trebalo!

Hvala jos jednom!
Having an idea is like being in a nutshell, but exchanging idea and collaborate
with
others is like being in infinite ocean of knowledge.
________________________________________________________________
____

Veruj u sebe. Ako ti neces, ko hoce?!

„Bolje živeti 100 godina kao milioner, nego sedam dana u bedi.“
 
Odgovor na temu

[es] :: Skript jezici :: Kako ovo izvesti?

[ Pregleda: 10685 | Odgovora: 2 ] > FB > Twit

Postavi temu Odgovori

Navigacija
Lista poslednjih: 16, 32, 64, 128 poruka.