09-16-2009
Thank you Franklin52 .but I didn't inscribe any code in my post . I have added the values i want to extract and change. Can you Please post this
10 More Discussions You Might Find Interesting
1. UNIX for Dummies Questions & Answers
I would like to prompt for input and then use it as a variable in a script.
Something like this.
#!/bin/ksh
echo "What is your name?: \c"
read response
echo "Your name is $reply" >file.txt
done
exit 0
What am I missing?
Thanks, (7 Replies)
Discussion started by: darthur
7 Replies
2. Shell Programming and Scripting
Hi guys,
I am new to AWK and unix scripting. Please see below my problem and let me know if anyone you can help.
I have 2 input files (example given below)
Input file 2 is a standard file (it will not change) and we have to get the name (second column after comma) from it and append it... (5 Replies)
Discussion started by: sksahu
5 Replies
3. Shell Programming and Scripting
Hi,
I have a folder which contains multiple config.xml files and one input file, Please see the below format.
Config Files format looks like :-
Code:
<application name="SAMPLE-ARCHIVE">
<NVPairs name="Global Variables">
<NameValuePair>
... (0 Replies)
Discussion started by: haiksuresh
0 Replies
4. Shell Programming and Scripting
SHELL SCRIPT
Hi,
I have 3 separate files within a folder. Every File contains data in a single column like
File1 contains data
mayank
sushant
dheeraj
File2 contains
DSA_AT
MG_AT
FLAT_09
File3 contains data
123123
232323 (2 Replies)
Discussion started by: mayanksargoch
2 Replies
5. Shell Programming and Scripting
Hi so far I created this script:
vi loop.beta.sh
for i in `cat extract.filenames.tabc`
do
echo $i
done>$i
===
This is the original text file.
$ more tabc.txt
-rwx------- 1 alice staff 1586 2010-11-05 02:27 request-key
.conf
-rwx------- 1 ted staff 126 ... (3 Replies)
Discussion started by: wolf@=NK
3 Replies
6. Shell Programming and Scripting
I have file A.txt
File A
1,Hi,234
2,Hello,345
1,Kal,980,
9,KJ,098
2,de,098
..
...
I have more then 600 lines...
I want separate the files as per 150 line.
First 150 lines ----File A1.xtx
Second 150 lines ---File A2.txt
Third 150 lines----File A3.txt.
... (4 Replies)
Discussion started by: asavaliya
4 Replies
7. Shell Programming and Scripting
Hi everyone!
I usually get large files with different groups of entries; for example, each line starts with A, B, C, D, or E. Is there a way to separate all these entries and then write them in 5 different files with one awk program?
Thank you! (4 Replies)
Discussion started by: Avro1986
4 Replies
8. Shell Programming and Scripting
I have a environment property file which contains:
Input file:
value1 = url1
value2 = url2
value3 = url3 and so on.
I need to search all *.xml files under directory for value1 and replace it with url1.
Same thing I have to do for all values mentioned in input file. I need script in unix bash... (7 Replies)
Discussion started by: Shamkamde
7 Replies
9. Shell Programming and Scripting
I have a directory with the files,
1st: I want to Diplay each filename, underline it
2nd: Display the contents under the filename and
3rd: Redirect the above content to other file
4th: Remove the files from the directory
#!/bin/ksh
for i in $( cat $a/b/c.txt )
do
echo "... (1 Reply)
Discussion started by: Aditya_001
1 Replies
10. UNIX for Beginners Questions & Answers
I am trying to consolidate multiple information files (<hostname>.Linux.nfslist) into one file so that I can import it into Excel. I can get the file contents with cat *Linux.nfslist >> nfslist.txt. I need each line prefaced with the hostname. I am unsure how to do this.
--- Post updated at... (5 Replies)
Discussion started by: Kentlee65
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)