01-31-2012
Try my solution from post #2 . Should work.
10 More Discussions You Might Find Interesting
1. Shell Programming and Scripting
i read the variable ph from file and i wanna to print it in awk.
example
ph=`cat tmpbatch`
tail h.txt|grep "| |"|awk -F"|" '{ print "@unpdx.sql",$5 }'"$ph"
i try this but it does not work (8 Replies)
Discussion started by: kazanoova2
8 Replies
2. Shell Programming and Scripting
How can I pass the name of the variable inside a for statment
I have a script something like below:
classA=12
classB=14
classC=16
# classD = 20
all_class="classA classB classC"
for i in $all_class
do
echo $i = $($i) #<---- this one not work
#echo $i = $(echo $i) ... (1 Reply)
Discussion started by: sun-guy
1 Replies
3. HP-UX
Hi,
Could any one please let me know what is the option
available in UNIX to print by specifying the paper size?
We are using Unix11i. I could n't see any option specified in the 'lp' command to print the report by specifying the size of the paper. It would be of great help to me, if... (1 Reply)
Discussion started by: ukarthik
1 Replies
4. Shell Programming and Scripting
:b:Hi All,
I have a part of a script below:
var1="value1"
awk 'BEGIN {printf("%36s \n ","value1")}'
Instead of directly giving the "value1" , I need to give using "var1" in the above awk statement.
Is this possible?
If so, what is the modified awk command?
Thanks in advance
JS (1 Reply)
Discussion started by: jisha
1 Replies
5. Shell Programming and Scripting
Let's say I want to print the arguments $4 till $#, how can I do this?
$# contains the number of arguments
$@ contain all the arguments as string
What i need is something like
for i in $4_till_$#; do
#do something with $i
convert $i ~/$output
done
The first 3 arguments are used as options... (6 Replies)
Discussion started by: hakermania
6 Replies
6. Shell Programming and Scripting
I have list of files:
ls
a.pdf
b.pdf
c.pdf
and so on...
and I have a file like this:
cat file1
apple
mango
pear
and so on...
I want to rename my file like this: (7 Replies)
Discussion started by: zorrox
7 Replies
7. Shell Programming and Scripting
Hi,
I've stored the output of a command into a variable.
The variable contains the following output:
outputline1 outputline2 outputline3 ...
How can I echo the variable so that the output is as follow and not one line:
outputline1
outputline2
outputline2
...
Thanks a lot! (4 Replies)
Discussion started by: Sego
4 Replies
8. Shell Programming and Scripting
hey,
just want to ask how to do this.
ex.
g="hi i am john"
h=`echo $g | awk '{print $2}'`
echo $h
OUTPUT is 'i'
What if I want to use a variable instead of using '2', how do I do that?
Because this one does not work:
a=2
h=`echo $g | awk '{print ${$a}}'`
this one also does not... (3 Replies)
Discussion started by: h0ujun
3 Replies
9. Shell Programming and Scripting
i have this variable:
varT="1--2--3--5"
i want to use awk to print field 3 from this variable. i dont want to do the "echo $varT".
but here's my awk code:
awk -v valA="$varT" "BEGIN {print valA}"
this prints the entire line. i feel like i'm so close to getting what i want. i... (4 Replies)
Discussion started by: SkySmart
4 Replies
10. Shell Programming and Scripting
Hi guys,
I have a file "abc.dat" in below format:
FILE_PATH||||$F_PATH
TABLE_LIST||||a|b|c
SYST_NM||||${SRC_SYST}
Now I am trying to read the above file and want to print the value for above dollar variables F_PATH and SRC_SYST. The problem is it's reading the dollar variables as... (5 Replies)
Discussion started by: abcabc1103
5 Replies
LEARN ABOUT DEBIAN
poe::component::pcap
Pcap(3pm) User Contributed Perl Documentation Pcap(3pm)
## Need an IO::Handle to $kernel->select_read() upon
$heap->{fdh} = IO::Handle->new_from_fd( $heap->{fd}, "r" )
or die "Can't create IO::Handle from pcap fd: $!
";
NAME
POE::Component::Pcap - POE Interface to Net::Pcap
SYNOPSIS
use POE::Component::Pcap;
POE::Component::Pcap->spawn(
Alias => 'pcap',
Device => 'eth0',
Filter => 'host fooble or host blort',
Dispatch => 'got_packet',
Session => $my_session_id,
);
$poe_kernel->post( pcap => open_live =>
'eth0', 80, 1, 100 );
$poe_kernel->post( pcap => set_filter => 'arp or host zooble' );
$poe_kernel->post( pcap => set_dispatch => 'target_state' );
$poe_kernel->post( pcap => 'run' );
$poe_kernel->post( pcap => 'shutdown' );
DESCRIPTION
POE::Component::Pcap provides a wrapper for using the Net::Pcap module from POE programs. The component creates a separate session which
posts events to a specified session and state when packets are available.
ARGUMENTS
Alias
The alias for the Pcap session. Used to post events such as "run" and "shutdown" to control the component. Defaults to "pcap" if not
specified.
Device
As a shortcut, the device for Net::Pcap to watch may be specified when creating the component. If this argument is used,
Net::Pcap::open_live will be called with a snaplen of 80 octets, a timeout of 100ms, and the interface will be put in promiscuous mode.
If these values are not suitable, post an "open_live" event instead.
Filter
Another shortcut, calls Net::Pcap::compile and Net::Pcap::setfilter to set a packet filter. This can only be used if the Device
argument is also given; otherwise a "set_filter" event should be posted after an "open_live" event (since Net::Pcap must have a
"pcap_t" descriptor to work with).
Dispatch
Session
These specify the session and state to which events should be posted when packets are received.
EVENTS
The following examples assume that the component's alias has been set to the default value of pcap.
open_live
$_[KERNEL]->post( pcap => open_live
=> 'device', [snaplen], [promsic?], [timeout] );
Calls Net::Pcap::open_live. The device name must be specified. The snaplen, promiscuous, and timeout parameters default to 80, 1, and
100 respectively. This event must be posted (or the Device argument must have been passed to spawn()) before anything else can be done
with the component.
set_filter
$_[KERNEL]->post( pcap => set_filter
=> 'host fooble or host blort' )
Sets the Net::Pcap capture filter. See tcpdump(8) for details on the filter language used by pcap(3).
set_dispatch
$_[KERNEL]->post( pcap => set_dispatch
=> 'target_state', 'target_session' );
Sets the state and session to which events are sent when packets are recevied. The target session will default to the sender of the
event if not specified.
The event posted will have a single argument (available as ARG0) which will be an array reference containing the $hdr and $pkt
parameters from Net::Pcap. See the Net::Pcap(3) documentation for more details.
run
$_[KERNEL]->post( pcap => 'run' );
Causes the component to register a select_read and start watching for packets.
shutdown
$_[KERNEL]->post( pcap => 'shutdown' );
Shuts the component down. Causes Net::Pcap::close to be called.
SEE ALSO
Net::Pcap(3), pcap(3), tcpdump(8), POE(3), POE::Component(3)
AUTHOR
Mike Fletcher, <fletch@phydeaux.org>
COPYRIGHT
Copyright 2000-2001, Mike Fletcher. All Rights Reserved. This is free software; you may redistribute it and/or modify it under the same
terms as Perl itself.
perl v5.10.1 2008-01-28 Pcap(3pm)