From owner-freebsd-questions@FreeBSD.ORG Mon Dec 17 12:22:23 2012 Return-Path: Delivered-To: freebsd-questions@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id C4085C26 for ; Mon, 17 Dec 2012 12:22:23 +0000 (UTC) (envelope-from jack.mclauren@yahoo.com) Received: from nm16.bullet.mail.bf1.yahoo.com (nm16.bullet.mail.bf1.yahoo.com [98.139.212.175]) by mx1.freebsd.org (Postfix) with ESMTP id 50AB58FC13 for ; Mon, 17 Dec 2012 12:22:23 +0000 (UTC) Received: from [98.139.212.148] by nm16.bullet.mail.bf1.yahoo.com with NNFMP; 17 Dec 2012 12:22:22 -0000 Received: from [98.139.212.235] by tm5.bullet.mail.bf1.yahoo.com with NNFMP; 17 Dec 2012 12:22:22 -0000 Received: from [127.0.0.1] by omp1044.mail.bf1.yahoo.com with NNFMP; 17 Dec 2012 12:22:22 -0000 X-Yahoo-Newman-Property: ymail-3 X-Yahoo-Newman-Id: 415031.26447.bm@omp1044.mail.bf1.yahoo.com Received: (qmail 52503 invoked by uid 60001); 17 Dec 2012 12:22:22 -0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yahoo.com; s=s1024; t=1355746942; bh=CWn9UqfabXDcLFbKSJ9OyD8Ju164l26DiHrCa+Zt4J4=; h=X-YMail-OSG:Received:X-Rocket-MIMEInfo:X-Mailer:References:Message-ID:Date:From:Reply-To:Subject:To:Cc:In-Reply-To:MIME-Version:Content-Type; b=uAnZwIhrbKAG9B8PC/cbxQvjf10nP+qNBo3FTWp205XcpEsS0ozBEmJbxU40LfoI1s5vGR9DVQSesdiDXXARL41iPGMLb7tCI161ulxWxixU9M9RsjoDaDhYrpN03O9pOjyw6kuCRXV4o51ux9tRLN4n42pPyX0cmXpVcMwxu60= DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=s1024; d=yahoo.com; h=X-YMail-OSG:Received:X-Rocket-MIMEInfo:X-Mailer:References:Message-ID:Date:From:Reply-To:Subject:To:Cc:In-Reply-To:MIME-Version:Content-Type; b=k0GehiREI2EkH8b9uK/h+gz+8mWTbdBbt1/MaWOA+RJKKYmo9injAq4A1FcSvh8b42kSwY8Sm2U/3d7OfrsJklSiww6OrA2WOjXKY8hv+WgztHgsnsgRPo39ARppLyJ41nGhb8uBgfJEfWNHQ6mRr6mWqgbMpVVD1XjAgismcK8=; X-YMail-OSG: Ufgqs5oVM1kG9Jk.vWizh59xieBg9WiScZYicVeDaaKYO5w K3XSsRsSxTo0InnU7Lw.1ps1E3ca4HfPiVVZ8I2cjs4yFBLsPKDzUcfHHJK4 8fr.TaSKj27iX9bOpxtL4U91ba4kBBd0HXXvWyYEiWLImZqzcVtfrVT_KS3A 0NYzRJ9XKH05TJiXpvxhTVll.E255mm2ZTZSogm2uOD8XyY64qfT33R0dgX6 fXDdiMprT9kJyDL3rDAcwYlXeUq1RDLMLVyxyojjKH0lKbtvd8S0q86ryStc smriMJlw_UC.FohDe1txaXRsecbJLLJUoWNrydXgtV9r2vUq7HlrM_U.i8CU O4wCuAfVNPXwV_9Kaz_U_WL6BxI0VdeXTGQ54qkGIEpn7lq7tcJU_tiGe5.c mDkmWJhM1wqPWQ6BfJJDQ34YAar5D6yFEF1u6enMGvUjxete8UDMM1k5lx2R qCmec93zuiRNhD6Yb2hEj.DCwZLtqJNKUzkT_fFkjw5lg0MVO.Bqf75Xvx30 yJnQsJaJjbUk- Received: from [89.165.120.140] by web160103.mail.bf1.yahoo.com via HTTP; Mon, 17 Dec 2012 04:22:21 PST X-Rocket-MIMEInfo: 001.001, Pj5IaSBKYWNrLAoKCgpISQoKPiBIb3cgY2FuIEkgcmVhZCBhIGZpbGUgd2hpY2ggY29udGFpbnMgYSBudW1iZXIgYW5kIGFzc2lnbiB0aGF0IG51bWJlciB0bwo.IGEgdmFyaWFibGUgdmlhIGF3ayBwcm9ncmFtbWluZz8gQnkgdGhlIHdheSwgSSB3YW50IHRvIHVzZSB0aGlzIGF3ayBwcm9ncmFtCj4gaW4gYSBzaGVsbCBzY3JpcHQuCgo.PkknbSBhY3R1YWxseSBub3Qgc3VyZSB3aGF0IHlvdSdyZSBhc2tpbmcsIGV4YWN0bHkgLS0geW91IHdhbnQgdGhlIG51bWJlcgo.PnRvIGdvIGludG8gYW4gYXdrIHZhcmkBMAEBAQE- X-Mailer: YahooMailWebService/0.8.129.483 References: <1355744359.61103.YahooMailNeo@web160104.mail.bf1.yahoo.com> <8EA88B4E-9C21-4CF7-9AB0-87663AB876F8@wolfhut.org> Message-ID: <1355746941.52411.YahooMailNeo@web160103.mail.bf1.yahoo.com> Date: Mon, 17 Dec 2012 04:22:21 -0800 (PST) From: Jack Mc Lauren Subject: Re: using AWK To: Ben Cottrell In-Reply-To: <8EA88B4E-9C21-4CF7-9AB0-87663AB876F8@wolfhut.org> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: quoted-printable X-Content-Filtered-By: Mailman/MimeDel 2.1.14 Cc: "freebsd-questions@freebsd.org" X-BeenThere: freebsd-questions@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list Reply-To: Jack Mc Lauren List-Id: User questions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 17 Dec 2012 12:22:23 -0000 >>Hi Jack,=0A=0A=0A=0AHI=0A=0A> How can I read a file which contains a numb= er and assign that number to=0A> a variable via awk programming? By the way= , I want to use this awk program=0A> in a shell script.=0A=0A>>I'm actually= not sure what you're asking, exactly -- you want the number=0A>>to go into= an awk variable? Or a shell variable?=0A=0AYes, I want the number to go in= to an awk variable.=0A=0A>>Assuming you want it to go into an awk variable,= I would try something=0A>>like this:=0A=0A>> =A0 =A0getline my_number < fi= lename;=0A>> =A0 =A0close filename;=0A=0A>>That assumes the filename is sto= red in the variable named "filename".=0A>>It puts the number in the awk var= iable named "my_number".=0A=0A>>To put that in context, let's say you're ge= tting the filename from $0,=0A>>and you want to multiply the number by 2 an= d print it. You might do:=0A=0A>> =A0 =A0filename =3D $0;=0A>> =A0 =A0getli= ne my_number < filename;=0A>> =A0 =A0close filename;=0A>> =A0 =A0print my_n= umber * 2;=0A=0A>>Or if I completely misinterpreted your question, let me k= now :-)=0A=0A>> =A0 =A0~Ben=0A=0A=0AThis is what i wrote:=0A=0A=0A#! /bin/s= h=0A=0Afilename=3D$0=0Aawk 'getline no < filename; print no'=0A=0ABut when = I run this script=0A=0Ash /awk_no.sh /var/no.txt=0A=0AI have this error := =0A=0Aawk: syntax error at source line 1=0A=A0context is=0A=A0 =A0 =A0 =A0 = getline no < filename; >>> =A0print <<< =A0no=0Aawk: bailing out at source = line 1=0A=0AThank you :) From owner-freebsd-questions@FreeBSD.ORG Mon Dec 17 12:38:08 2012 Return-Path: Delivered-To: freebsd-questions@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id BB24D2A5 for ; Mon, 17 Dec 2012 12:38:08 +0000 (UTC) (envelope-from radek.krejca@starnet.cz) Received: from EXCHANGE.mail.starnet.cz (exchange.mail.starnet.cz [92.62.224.72]) by mx1.freebsd.org (Postfix) with ESMTP id 1A6218FC12 for ; Mon, 17 Dec 2012 12:38:07 +0000 (UTC) Received: from EXCHANGE.mail.starnet.cz ([fe80::7534:a1f0:da0:e34d]) by EXCHANGE.mail.starnet.cz ([fe80::7534:a1f0:da0:e34d%15]) with mapi; Mon, 17 Dec 2012 13:36:59 +0100 From: =?iso-8859-2?Q?Radek_Krej=E8a?= To: "freebsd-questions@freebsd.org" Date: Mon, 17 Dec 2012 13:36:58 +0100 Subject: Unecpected change default route in 9.0, 8.2 Thread-Topic: Unecpected change default route in 9.0, 8.2 Thread-Index: Ac3cUzabAVg4D2pjQneu71cOHB8g/w== Message-ID: Accept-Language: cs-CZ Content-Language: cs-CZ X-MS-Has-Attach: X-MS-TNEF-Correlator: acceptlanguage: cs-CZ Content-Type: text/plain; charset="iso-8859-2" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-BeenThere: freebsd-questions@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: User questions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 17 Dec 2012 12:38:08 -0000 Hi, I have diskless routers, on one of theese I have problem, that default = gate is changing.=20 Image is clean and updated. There is no route daemon, no snmp, dhclient isn= t running. Whith resarch in cooperation in chzech bsd mailing list I get following thi= ngs: Ifconfig of this machine is: ifconfig -a: em0: flags=3D8843 metric 0 mtu 1500 options=3D219b ether 00:25:90:a1:f5:a9 inet 178.255.168.19 netmask 0xfffff800 broadcast 178.255.175.255 inet6 fe80::225:90ff:fea1:f5a9%em0 prefixlen 64 scopeid 0x1 inet6 2a02:768:0:4000::19 prefixlen 64 nd6 options=3D21 media: Ethernet autoselect (1000baseT ) status: active em1: flags=3D8943 metric 0 = mtu 1500 options=3D219b ether 00:25:90:a1:f5:a8 inet6 fe80::225:90ff:fea1:f5a8%em1 prefixlen 64 scopeid 0x3 inet 10.1.11.1 netmask 0xfffffffc broadcast 10.1.11.3 nd6 options=3D21 media: Ethernet autoselect (1000baseT ) status: active vlan304: flags=3D8843 metric 0 mtu = 1500 options=3D3 ether 00:25:90:a1:f5:a8 inet 10.219.11.97 netmask 0xffffffe0 broadcast 10.219.11.127 inet6 fe80::225:90ff:fea1:f5a8%vlan304 prefixlen 64 scopeid 0xb4 inet 10.9.114.1 netmask 0xfffffffc broadcast 10.9.114.3 nd6 options=3D21 media: Ethernet autoselect (1000baseT ) status: active vlan: 304 parent interface: em1 After attack isnot affected. Ip of machine is 178.255.168.19, default route= is 178.255.168.254.=20 netstat -nr|less Routing tables Internet: Destination Gateway Flags Refs Use Netif Expire default 178.255.168.254 UGS 0 8766645 em0 After change look like this: netstat -nr Routing tables Internet: Destination Gateway Flags Refs Use Netif Expire default 189.71.208.123 UGS 1 1184931064 em0 This is example, ip of gateway is random. route monitor tells (there is other ip, route monitor runs later, on other = attack). got message of size 192 on Mon Dec 17 13:19:20 2012 RTM_DELETE: Delete Route: len 192, pid: 21546, seq 1, errno 0, flags: locks: inits: sockaddrs: default 175.139.119.60 default Is possilble, that icmp redirect can change default route? No other user, t= han me, are logged to system. Thank you Radek