05-19-2011
It would be easier if you post sample data: input and expected output.
10 More Discussions You Might Find Interesting
1. Shell Programming and Scripting
Anyone here knows any reasonably priced courses for independent (not corporate) users that can point me to. Already know Unix commands/vi/etc but now need scripting too. Any replies will be appreciated. (2 Replies)
Discussion started by: FastFood
2 Replies
2. Linux
Please Let me know this Que and Ans please Because i applied for a H1B VISA nad i have a INTERVIEW as soon so please "Difference between Linux and Unix and also C and C++ and also about Shell Scripting about all Questions and Answers ." (3 Replies)
Discussion started by: madhav
3 Replies
3. Linux
Well Acording to my job...
Anyhelp plz.
I need some basic scripting stuff. (3 Replies)
Discussion started by: Irish Jimmy
3 Replies
4. Linux
I want to learn Linux/Unix shell scripting, I searched this forum but got some results for Unix Admin books and general Linux books.
Would someone recommend a good Linux Shell Scripting book?
I did order one book
A Practical Guide to Linux(R) Commands, Editors, and Shell Programming ... (4 Replies)
Discussion started by: thoughts
4 Replies
5. Shell Programming and Scripting
In shell Can I pass " to a program ? If not what is the work around ..?
Can I define * as a wild card charecter that will return all the values from
the files ..?
I am trying to create a tool that will return the values from a property file . This tool has to support all the wild card... (1 Reply)
Discussion started by: app1sxv
1 Replies
6. Shell Programming and Scripting
Hi,
I have general question: i have good working Perl script with .pl extension, and now I have to migrate all to another Linux box, and I was told that I can use only shell scripting, so I'm not sure how different those two things are, will it work without any changes . Is there anything smart I... (6 Replies)
Discussion started by: trento17
6 Replies
7. Shell Programming and Scripting
hi
My script as below
#!/bin/ksh
for i in `seq 1 7`
do
a=$(awk '{print $i}' /home/rama/expenese.txt)
done
for i in `seq 1 7`
do
echo "${a}"
done
content of expense.txt is as below
5032 210179 3110 132813874 53488966 11459221 5300794
I want output as... (6 Replies)
Discussion started by: Ramakrishna V
6 Replies
8. Homework & Coursework Questions
Use and complete the template provided. The entire template must be completed. If you don't, your post may be deleted!
1. The problem statement, all variables and given/known data:
This is what is asked:
If the user enters ‘3’, prompt the user for two file names. Verify that the file names... (2 Replies)
Discussion started by: cindy01
2 Replies
9. UNIX for Beginners Questions & Answers
This is the sample json I have pasted here. I want all the IP address strings to be converted into an array. For example "10.38.32.202" has to be converted to everywhere in the JSON. There are multiple IPs in a JSON I am pasting one sample object from the JSON. But the IPs already in an Array... (11 Replies)
Discussion started by: vinshas1
11 Replies
10. Shell Programming and Scripting
Hi,
I would like to know how to define the size of the array in c shell scripting. (15 Replies)
Discussion started by: gopishrine
15 Replies
Packet sample action in tc(8) Linux Packet sample action in tc(8)
NAME
sample - packet sampling tc action
SYNOPSIS
tc ... action sample rate RATE group GROUP [ trunc SIZE ] [ index INDEX ]
tc ... action sample index INDEX
DESCRIPTION
The sample action allows sampling packets matching classifier.
The packets are chosen randomly according to the rate parameter, and are sampled using the psample generic netlink channel. The user can
also specify packet truncation to save user-kernel traffic. Each sample includes some informative metadata about the original packet, which
is sent using netlink attributes, alongside the original packet data.
The user can either specify the sample action parameters as presented in the first form above, or use an existing sample action using its
index, as presented in the second form.
SAMPLED PACKETS METADATA FIELDS
The metadata are delivered to userspace applications using the psample generic netlink channel, where each sample includes the following
netlink attributes:
PSAMPLE_ATTR_IIFINDEX
The input interface index of the packet, if there is one.
PSAMPLE_ATTR_OIFINDEX
The output interface index of the packet. This field is not relevant on ingress sampling
PSAMPLE_ATTR_ORIGSIZE
The size of the original packet (before truncation)
PSAMPLE_ATTR_SAMPLE_GROUP
The psample group the packet was sent to
PSAMPLE_ATTR_GROUP_SEQ
A sequence number of the sampled packet. This number is incremented with each sampled packet of the current psample group
PSAMPLE_ATTR_SAMPLE_RATE
The rate the packet was sampled with
OPTIONS
rate RATE
The packet sample rate. RATE is the expected ratio between observed packets and sampled packets. For example, RATE of 100 will lead
to an average of one sampled packet out of every 100 observed.
trunc SIZE
Upon set, defines the maximum size of the sampled packets, and causes truncation if needed
group GROUP
The psample group the packet will be sent to. The psample module defines the concept of groups, which allows the user to match spe-
cific sampled packets in the case of multiple sampling rules, thus identify only the packets that came from a specific rule.
index INDEX
Is a unique ID for an action. When creating new action instance, this parameter allows to set the new action index. When using
existing action, this parameter allows to specify the existing action index. The index must 32bit unsigned integer greater than
zero.
EXAMPLES
Sample one of every 100 packets flowing into interface eth0 to psample group 12:
tc qdisc add dev eth0 handle ffff: ingress
tc filter add dev eth0 parent ffff: matchall
action sample rate 100 group 12 index 19
Use the same action instance to sample eth1 too:
tc qdisc add dev eth1 handle ffff: ingress
tc filter add dev eth1 parent ffff: matchall
action sample index 19
SEE ALSO
tc(8), tc-matchall(8) psample(1)
iproute2 31 Jan 2017 Packet sample action in tc(8)