Sponsored Content
Top Forums Shell Programming and Scripting Insert Columns before the last Column based on the Count of Delimiters Post 302914195 by Scrutinizer on Friday 22nd of August 2014 01:15:12 PM
Old 08-22-2014
c (139) is the number of columns. To get 139 delimiters use c=140 instead of c=139..
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Count first column on the basis of two other columns

Hello, I have a file ================= 12 SRV1 GRP1 19 SRV1 GRP1 19 SRV1 GRP2 3 SRV1 GRP1 3 SRV1 GRP2 30 SRV1 GRP2 7 SRV1 GRP1 8 SRV1 GRP3 =========== I want output like =============== 41 SRV1 GRP1 52 SRV1 GRP2 8 SRV1 GRP3 (1 Reply)
Discussion started by: kaustubh137
1 Replies

2. Shell Programming and Scripting

insert leading zeroes based on the character count

Hi, I need add leading zeroes to a field in a file based on the character count. The field can be of 1 character to 6 character length. I need to make the field 14bytes. eg: 8351,20,1 8351,234,6 8351,2,0 8351,1234,2 8351,123456,1 8351,12345,2 This should become. ... (3 Replies)
Discussion started by: gpaulose
3 Replies

3. Shell Programming and Scripting

Insert new line based on numerical number of column

My input file: Class Number Position Range 1 Initial 50 1 Initial 50 2 Terminal 150 2 Terminal 20 2 Single 10 3 Single 20 4 Double 50 5 Initial 50 5 Initial 60 Class Number... (11 Replies)
Discussion started by: patrick87
11 Replies

4. UNIX for Dummies Questions & Answers

How to insert alternative columns and sort text from first column to second?

Hi Everybody, I am just new to UNIX as well as to this forum. I have a text file with 10,000 coloumns and each coloumn contains values separated by space. I want to separate them into new coloumns..the file is something like this as ad af 1 A as ad af 1 D ... ... 1 and A are in one... (7 Replies)
Discussion started by: Unilearn
7 Replies

5. Shell Programming and Scripting

Count Columns and If less add new column

Hi All, My Input.txt should have always 4 columns in some cases i may not get all the 4columns data. My requirement is if columns as not equal to 4 then append new column delimiter. Input.txt A,1,2 B,1,2,3 C,1 Desired output should be in below format Output.txt A,1,2,... (3 Replies)
Discussion started by: kmsekhar
3 Replies

6. Shell Programming and Scripting

count the unique records based on certain columns

Hi everyone, I have a file result.txt with records as following and another file mirna.txt with a list of miRNAs e.g. miR22, miR123, miR13 etc. Gene Transcript miRNA Gar Nm_111233 miR22 Gar Nm_123440 miR22 Gar Nm_129939 miR22 Hel Nm_233900 miR13 Hel ... (6 Replies)
Discussion started by: miclow
6 Replies

7. Shell Programming and Scripting

Insert space in specific column among many columns

Hello, I have some problem in inserting the space for the pairs of columns. I have the input file : I used this code below in replacing it using space in specific column (replace space in each two columns) sed -e "s/,/ /2" -e "s/,/ /3" inputfile Output showed : However, I have many... (3 Replies)
Discussion started by: awil
3 Replies

8. Shell Programming and Scripting

Insert value of column based on file name matching

At the top of the XYZ file, I need to insert the ABC data value of column 2 only when ABC column 1 matches the prefix XYZ file name (not the ".txt"). Is there an awk solution for this? ABC Data 0101 0.54 0102 0.48 0103 1.63 XYZ File Name 0101.txt 0102.txt 0103.txt ... (7 Replies)
Discussion started by: ncwxpanther
7 Replies

9. Shell Programming and Scripting

Convert rows to columns based on key and count

Team, I am having requirement to convert rows to columns Input is: key ,count, id1, pulse1, id2, pulse2 ,id3, pulse3 12, 2 , 14 , 56 , 15, 65 13, 3, 12, 32, 14, 23, 18, 54 22, 1 , 32, 42 Expected Out put: key, id,pulse 12, 14, 56 12, 15, 65 13 ,12, 32 13, 14 ,23 13, 18 ,54 22 ,32,... (3 Replies)
Discussion started by: syam1406
3 Replies

10. Shell Programming and Scripting

Linux shell script to insert new lines based on delimiter count

The input file is a .dat file which is delimited by null (^@ in Linux). On a windows PC it looks something like this (numbers are masked with 1). https://i.imgur.com/nta2Gqp.jpg The entire file is in one row but it has multiple records - each record contains 80 fields i.e. there are 81 counts... (9 Replies)
Discussion started by: digitalnirvana
9 Replies
ICMP6(4)                                                   BSD Kernel Interfaces Manual                                                   ICMP6(4)

NAME
icmp6 -- Internet Control Message Protocol for IPv6 SYNOPSIS
#include <sys/socket.h> #include <netinet/in.h> #include <netinet/icmp6.h> int socket(AF_INET6, SOCK_RAW, IPPROTO_ICMPV6); DESCRIPTION
ICMPv6 is the error and control message protocol used by IPv6 and the IPv6 protocol family (see ip6(4) and inet6(4)). It may be accessed through a ``raw socket'' for network monitoring and diagnostic functions. The proto parameter to the socket(2) call to create an ICMPv6 socket may be obtained from getprotobyname(3). ICMPv6 sockets are connection- less, and are normally used with the sendto(2) and recvfrom(2) calls, though the connect(2) call may also be used to fix the destination for future packets (in which case read(2) or recv(2) and write(2) or send(2) system calls may be used). Outgoing packets automatically have an IPv6 header prepended to them (based on the destination address). Incoming packets on the socket are received with the IPv6 header and any extension headers removed. Types ICMPv6 messages are classified according to the type and code fields present in the ICMPv6 header. The abbreviations for the types and codes may be used in rules in pf.conf(5). The following types are defined: Num Abbrev. Description 1 unreach Destination unreachable 2 toobig Packet too big 3 timex Time exceeded 4 paramprob Invalid IPv6 header 128 echoreq Echo service request 129 echorep Echo service reply 130 groupqry Group membership query 130 listqry Multicast listener query 131 grouprep Group membership report 131 listenrep Multicast listener report 132 groupterm Group membership termination 132 listendone Multicast listerner done 133 routersol Router solicitation 134 routeradv Router advertisement 135 neighbrsol Neighbor solicitation 136 neighbradv Neighbor advertisement 137 redir Shorter route exists 138 routrrenum Route renumbering 139 fqdnreq FQDN query 139 niqry Node information query 139 wrureq Who-are-you request 140 fqdnrep FQDN reply 140 nirep Node information reply 140 wrurep Who-are-you reply 200 mtraceresp mtrace response 201 mtrace mtrace messages The following codes are defined: Num Abbrev. Type Description 0 noroute-unr unreach No route to destination 1 admin-unr unreach Administratively prohibited 2 beyond-unr unreach Beyond scope of source address 2 notnbr-unr unreach Not a neighbor (obselete) 3 addr-unr unreach Address unreachable 4 port-unr unreach Port unreachable 0 transit timex Time exceeded in transit 1 reassemb timex Time exceeded in reassembly 0 badhead paramprob Erroneous header field 1 nxthdr paramprob Unrecognized next header 2 redir Unrecognized option 0 redironlink redir Redirection to on-link node 1 redirrouter redir Redirection to better router Headers All ICMPv6 messages are prefixed with an ICMPv6 header. This header corresponds to the icmp6_hdr structure and has the following definition: struct icmp6_hdr { u_int8_t icmp6_type; /* type field */ u_int8_t icmp6_code; /* code field */ u_int16_t icmp6_cksum; /* checksum field */ union { u_int32_t icmp6_un_data32[1]; /* type-specific */ u_int16_t icmp6_un_data16[2]; /* type-specific */ u_int8_t icmp6_un_data8[4]; /* type-specific */ } icmp6_dataun; } __packed; #define icmp6_data32 icmp6_dataun.icmp6_un_data32 #define icmp6_data16 icmp6_dataun.icmp6_un_data16 #define icmp6_data8 icmp6_dataun.icmp6_un_data8 #define icmp6_pptr icmp6_data32[0] /* parameter prob */ #define icmp6_mtu icmp6_data32[0] /* packet too big */ #define icmp6_id icmp6_data16[0] /* echo request/reply */ #define icmp6_seq icmp6_data16[1] /* echo request/reply */ #define icmp6_maxdelay icmp6_data16[0] /* mcast group membership*/ icmp6_type describes the type of the message. Suitable values are defined in <netinet/icmp6.h>. icmp6_code describes the sub-type of the message and depends on icmp6_type. icmp6_cksum contains the checksum for the message and is filled in by the kernel on outgoing messages. The other fields are used for type-specific purposes. Filters Because of the extra functionality of ICMPv6 in comparison to ICMPv4, a larger number of messages may be potentially received on an ICMPv6 socket. Input filters may therefore be used to restrict input to a subset of the incoming ICMPv6 messages so only interesting messages are returned by the recv(2) family of calls to an application. The icmp6_filter structure may be used to refine the input message set according to the ICMPv6 type. By default, all messages types are allowed on newly created raw ICMPv6 sockets. The following macros may be used to refine the input set: void ICMP6_FILTER_SETPASSALL(struct icmp6_filter *filterp) Allow all incoming messages. filterp is modified to allow all message types. void ICMP6_FILTER_SETBLOCKALL(struct icmp6_filter *filterp) Ignore all incoming messages. filterp is modified to ignore all message types. void ICMP6_FILTER_SETPASS(int type, struct icmp6_filter *filterp) Allow ICMPv6 messages with the given type. filterp is modified to allow such messages. void ICMP6_FILTER_SETBLOCK"(int type, struct icmp6_filter *filterp) Ignore ICMPv6 messages with the given type. filterp is modified to ignore such messages. int ICMP6_FILTER_WILLPASS"(int type, const struct icmp6_filter *filterp) Determine if the given filter will allow an ICMPv6 message of the given type. int ICMP6_FILTER_WILLBLOCK"(int type, const struct icmp6_filter *filterp) Determine if the given filter will ignore an ICMPv6 message of the given type. The getsockopt(2) and setsockopt(2) calls may be used to obtain and install the filter on ICMPv6 sockets at option level IPPROTO_ICMPV6 and name ICMPV6_FILTER with a pointer to the icmp6_filter structure as the option value. SEE ALSO
getsockopt(2), recv(2), send(2), setsockopt(2), socket(2), getprotobyname(3), inet6(4), ip6(4), netintro(4) W. Stevens and M. Thomas, Advanced Sockets API for IPv6, RFC 2292, February 1998. A. Conta and S. Deering, Internet Control Message Protocol (ICMPv6) for the Internet Protocol Version 6 (IPv6) Specification, RFC 2463, December 1998. BSD December 20, 2004 BSD
All times are GMT -4. The time now is 09:44 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy