Sponsored Content
Top Forums Shell Programming and Scripting Add column base on same name of second column Post 302897107 by SriniShoo on Friday 11th of April 2014 02:46:47 AM
Old 04-11-2014
Code:
awk '{if($2 !~ /[0-9]/) {$3 = $2}; a[NR] = $0}
  END {for(i = NR; i >= 1; i--)
    {split(a[i], b, FS);
 if(b[3] != "") {t = b[3]};
 c[i] = (b[1] FS b[2] FS t)}; delete a;
 for(i = 1; i <= NR; i++) print c[i]}' A.txt

---------- Post updated at 02:46 AM ---------- Previous update was at 02:15 AM ----------

even this code will work
Code:
awk '{a[NR] = $0}
  END {for(i = NR; i >= 1; i--) {split(a[i], p, FS);
    if(p[2] !~ /[0-9]/) {c = p[2]};
 b[i] = (a[i] FS c); delete a[i]};
    for(i = 1; i <= NR; i++) {print b[i]}}' file

This User Gave Thanks to SriniShoo For This Post:
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Need to add letters to a column and add in a new column subtracting from another column

So I have this input 1 10327 rs112750067 T C . PASS DP=65;AF=0.208;CB=BC,NCBI 1 10469 rs117577454 C G . PASS DP=2055;AF=0.020;CB=UM,BC,NCBI 1 10492 rs55998931 C T . PASS DP=231;AF=0.167;CB=BC,NCBI 1 10583 rs58108140 G A ... (3 Replies)
Discussion started by: kellywilliams
3 Replies

2. Shell Programming and Scripting

to add special tag to a column based on column condition

Hi All, I have following html code <TR><TD>9</TD><TD>AR_TVR_TBS </TD><TD>85000</TD><TD>39938</TD><TD>54212</TD><TD>46</TD></TR> <TR><TD>10</TD><TD>ASCV_SMY_TBS </TD><TD>69880</TD><TD>33316</TD><TD>45698</TD><TD>47</TD></TR> <TR><TD>11</TD><TD>ARC_TBS ... (9 Replies)
Discussion started by: ckwan
9 Replies

3. Shell Programming and Scripting

Change column to row base on column 2

Hi Guys, Input.txt L194 A -118.2 L194 B -115.1 L194 C -118.7 L196 A 0 L196 C 0 L197 A -111.2 L197 B -118.9 L197 C -119.9 L199 A -120.4 L199 B -119.9 ... (2 Replies)
Discussion started by: asavaliya
2 Replies

4. Shell Programming and Scripting

Copy same name data from other file base on column

HI I have input file A.txt X Y Z File B.txt 1 X 10 AAA 11123 2 Y 22 PlD 4563 3 Z 55 PlD 54645 4 Z 66 PlD 15698 5 F 44 PlD 154798 6 C 55 PlD 12554 7 Z 88 PlD 23265 8 C 99 PlD 151654 9 C 11 PlD 21546546 I need New File C.txt (1 Reply)
Discussion started by: pareshkp
1 Replies

5. Shell Programming and Scripting

Change Data base on Column

Base of last two column i want to change may data if Last two Column have A and C then Copy Column $4 to Column $3. Input :- DD142 0_1 DD142_A DD142_B A B DD142 1_1 DD142_B DD142_C B C DD142 2_1 DD142_A DD142_C A C DD142 3_1 DD142_A A DD142 3_2 DD142_A A DD142 4_1 DD142_B B ... (4 Replies)
Discussion started by: pareshkp
4 Replies

6. Shell Programming and Scripting

Add Column base on other Column Data

HI Guys, I want add one extra Column base on 3rd Column . Input :- M204 MS204_154 :vsDataUeMe M204 MS204_154 es:sMeasure 0 M204 MS204_154 es:90ilterCoe 9 M204 MS204_154 es:searchE9090ortTime 40 M204 MS204_154 es:servOrPrioI90HoTimer 4000 M204 MS204_154 es:ueMeajllls154545 TRUE... (5 Replies)
Discussion started by: pareshkp
5 Replies

7. Shell Programming and Scripting

Grep Data Base on Column

HI Want to grep data from column header and match with second file. File A.txt 1 2 3 4 5 6 X1 A L D J Q R X2 B M K P w T X3 C S L P e Y X4 R Z M A r U FileB.txt 1 2 3 4 6 7 (3 Replies)
Discussion started by: pareshkp
3 Replies

8. Shell Programming and Scripting

Sum of Columns Base on First Column

Input :- Hd1;Hd2:hd3;Hd4;Hd5 X;1;2;3;4 Y;2;3;5;6 Z;3;5;6;7 X;10;11;24;16 Y;11;23;21;1 Z;10;13;14;15 X;0;1;2;0 K;0;0;0;0 K;0;0;0;0 I want Sum Data base on first column; Hd1;Hd2:hd3;Hd4;Hd5 X;11;14;29;20 Y;12;26;26;7 Z;13;18;20;22 K;0;0;0;0 (4 Replies)
Discussion started by: pareshkp
4 Replies

9. Shell Programming and Scripting

Column to Row base on first and second Column

Input :- Column to Row Time CT 1 2 3 17:45 X 10 15 20 18:00 X 15 20 30 18:15 X 10 10 10 18:30 X 5 5 5 17:45 Y 10 15 20 18:00 Y 15 20 30 18:15 Y 10 10 10 18:30 Y 5 5 5 output:- Time P X Y 17:45 1 10 10 18:00 1 15 15 18:15 1 10 10 (2 Replies)
Discussion started by: pareshkp
2 Replies

10. UNIX for Beginners Questions & Answers

Add column and multiply its result to all elements of another column

Input file is as follows: 1 | 6 2 | 7 3 | 8 4 | 9 5 | 10 Output reuired (sum of the first column $1*$2) 1 | 6 | 90 2 | 7 | 105 3 | 8 | 120 4 |9 | 135 5 |10 | 150 Please enclose sample input, sample output, and code... (5 Replies)
Discussion started by: Sagar Singh
5 Replies
L2tpIPsecVpn(1) 					      General Commands Manual						   L2tpIPsecVpn(1)

NAME
L2tpIPsecVpn - L2tp over IPsec VPN Manager applet for the GNOME Desktop SYNOPSIS
L2tpIPsecVpn [options] DESCRIPTION
This GUI is not a network manager plugin. However, it provides a systray icon in the indicator applet from which a non privileged user can establish and bring down L2TP over IPsec VPN connections. From there the user can add, remove and edit vpn connections. Editing allows configuring various options for IPsec, L2TP and PPP. Among others, the user can configure eg. the gateway, the use of either PSK or a certificate for authentication, various L2TP options as redial- timeout and attempts and of course all important PPP options. It also allows you to configure PPP for tunnel splitting because you can add routes as you want. When applying your settings, all necessary configuration files are written accordingly (ipsec.conf, xl2tp.conf, options.xl2tpd, opensc.conf up and down scripts ...). It relies on Openswan and xl2tp packages as the underlying protocol handlers. You can also use certificates on your local machine or, if e.g. OpenSC is installed and configured, even on a smart card to handle PPP authentication. The GUI automatically detects when network interfaces are going up or down and can (if so configured) automatically establish or close VPN connections. OPTIONS
startConnectionEditor Starts the connection editor dialog. applySettings Write configuration files according to the connection settings, must be started with root privileges, ie use gksudo as non root user. deleteAllConfFiles Delete all configuration files, must be started with root privileges, ie use gksudo as non root user. AUTHORS
Werner Jaeger version 1.0.9 11 Oct 2012 L2tpIPsecVpn(1)
All times are GMT -4. The time now is 08:15 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy