Sponsored Content
Top Forums UNIX for Dummies Questions & Answers Swap two rows in a space delimited text file? Post 302726221 by guruprasadpr on Sunday 4th of November 2012 01:15:03 AM
Old 11-04-2012
Hi

Please post your sample input file and expected output file to give us some clarity.

Guru.
 

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

Searching for text in a Space delimited File

Hi I am trying to search a firewall syslog space delimeted file for all of the different tcp and udp destination ports. I know that grep will find lines that contain specific text. And I have tried using the the the cut command to cut out of the file certain colums. However the test I am... (6 Replies)
Discussion started by: andyblaylock
6 Replies

2. Shell Programming and Scripting

replace 3rd field of space delimited text file

how to replace the 3rd colum? Each line begins similarly, but they all ends variously. XX YY 03 variable text here XX YY 03 more variable text here XX YY 03 even more variable text here really long setence XX YY 03 variable numbers also appear 03 11. 123 456 XX YY 03 the occasional comma,... (4 Replies)
Discussion started by: ajp7701
4 Replies

3. UNIX for Dummies Questions & Answers

Deleting columns from a space delimited text file

I have a space delimited text file with 1,000,000+ columns and 100 rows. I want to delete columns 2 through 5 (2 and 5) included from the text file. How do I do that? Thanks. (3 Replies)
Discussion started by: evelibertine
3 Replies

4. UNIX for Dummies Questions & Answers

Deleting cells that contain a specific number only from a space delimited text file

I have this space delimited large text file with more than 1,000,000+ columns and about 100 rows. I want to delete all the cells that consist of just 2 (leave 2's that are not by themselves intact): File before modification aa bb cc 2 NA100 dd aa b1 c2 2 NA102 de File after modification... (1 Reply)
Discussion started by: evelibertine
1 Replies

5. UNIX for Dummies Questions & Answers

How do you view specific columns from a space delimited text file?

I have a space delimited text file with 1,000,000+ columns? I would only like to view specific ones (let's say through 1:10), how can I do that? Thanks! (3 Replies)
Discussion started by: evelibertine
3 Replies

6. Shell Programming and Scripting

Convert Rows to Space Delimited Line

Hello, I would like to convert a list of rows to a space separated line. Any ideas? Input file: "Administration Tools" "Design Suite" "Dial-up Networking Support" "Editors" desired output "Administration Tools" "Design Suite" "Dial-up Networking Support" "Editors" Thanks,... (4 Replies)
Discussion started by: jaysunn
4 Replies

7. UNIX for Dummies Questions & Answers

Converting a text file with irregular spacing into a space delimited text file?

I have a text file with irregular spacing between values which makes it really difficult to manipulate. Is there an easy way to convert it into a space delimited text file so that all the spaces, double spaces, triple spaces, tabs between numbers are converted into spaces. The file looks like this:... (5 Replies)
Discussion started by: evelibertine
5 Replies

8. UNIX for Dummies Questions & Answers

Adding tags to a specific column of a space delimited text file

I have a space delimited text file with two columns. I would like to add NA to the first column of the text file. Input: 19625 10.4791768259 19700 10.8146489183 19701 10.9084026759 19702 10.9861346978 19703 10.9304364984 Output: NA19625 10.4791768259 NA19700 10.8146489183... (1 Reply)
Discussion started by: evelibertine
1 Replies

9. UNIX for Dummies Questions & Answers

Extracting rows from a space delimited text file based on the values of a column

I have a space delimited text file. I want to extract rows where the third column has 0 as a value and write those rows into a new space delimited text file. How do I go about doing that? Thanks! (2 Replies)
Discussion started by: evelibertine
2 Replies

10. UNIX for Dummies Questions & Answers

Changing only the first space to a tab in a space delimited text file

Hi, I have a space delimited text file but I only want to change the first space to a tab and keep the rest of the spaces intact. How do I go about doing that? Thanks! (3 Replies)
Discussion started by: evelibertine
3 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)
All times are GMT -4. The time now is 12:42 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy