Sponsored Content
Top Forums Shell Programming and Scripting Grouping multiple columns and concatenate Post 302866413 by Jotne on Tuesday 22nd of October 2013 01:49:07 AM
Old 10-22-2013
Its not a good habit to use _ as an variable. New user would have problem understanding what is going on.
Change it to some like
Code:
awk -F, '{arr[$3]=arr[$3]?arr[$3] OFS $2:$1 FS $2} END {for(i in arr) print arr[i] FS i}' OFS=\| file

also removed some not needed parentheses around first test, and change the order of it to test for true.

Last edited by Jotne; 10-22-2013 at 02:59 AM..
This User Gave Thanks to Jotne For This Post:
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Find multiple patterns on multiple lines and concatenate output

I'm trying to parse COBOL code to combine variables into one string. I have two variable names that get literals moved into them and I'd like to use sed, awk, or similar to find these lines and combine the variables into the final component. These variable names are always VAR1 and VAR2. For... (8 Replies)
Discussion started by: wilg0005
8 Replies

2. Shell Programming and Scripting

concatenate 'n' number of columns in a file

i have a file which may have 'n' number of columns 1 222 fafda 32 afdaf 4343 4343 234 43fdaf 4343 fdd fdfd fdfd fdd fdfd fdfd fdfd fdfd fdfd fdd fdfd fdfd need to concatenate the columns with... (3 Replies)
Discussion started by: mlpathir
3 Replies

3. Shell Programming and Scripting

Concatenate columns from files

Hi, I have a file1.txt like this: and a file2.txt like this: I wat only append file2.txt to file1.txt and to have something like this: How could i do ? (2 Replies)
Discussion started by: AdminLew
2 Replies

4. Shell Programming and Scripting

Concatenate columns from multiple files

Hi all, I want the 2nd column of every file in the directory in a single file with the file name as column header. $cat file1.txt a b c d e f $cat file2.txt f g h g h j $cat file3.txt a b d f g h (2 Replies)
Discussion started by: newbie83
2 Replies

5. Shell Programming and Scripting

concatenate multiple file

Hi Need some help to concatenate files I have multiple spool files nearlly 15 of them which I need to concatenate like as shown in the below example for ex. file1.txt aaaa|bbbbb|cccc| dddd|eeee|ffff| kkkkk|uuuuu|gggg| file2.txt xxxx|yyyy|zzzz| 1111||kkkk|lllll... (2 Replies)
Discussion started by: rashmisb
2 Replies

6. Shell Programming and Scripting

regular expression grouping across multiple lines

cat book.txt book1 price 23 sku 1234 auth Bill book2 sku 1233 price 22 auth John book3 auth Frank price 24 book4 price 25 sku 129 auth Tod import re f = open('book.txt', 'r') text = f.read() f.close() m =... (2 Replies)
Discussion started by: chirish
2 Replies

7. UNIX for Dummies Questions & Answers

Concatenate two columns and separate by - (minus)

hi all could you please help me to concatenate two colomns and separate them by "-" the two colomns to concatenate are colomuns 1 and 3 of a very bif file clomn 1 is chr, 2 is snp and 3 is bp the new colomn is chr_B input file : 1 rs1111 10583 1 rs1891 10611 1 rs1807 ... (13 Replies)
Discussion started by: biopsy
13 Replies

8. Shell Programming and Scripting

How to concatenate 2-columns by 2 -columns for a text file?

Hello, I want to concatenate 2-columns by 2-columns separated by colon. How can I do so? For example, I have a text file containing 6 columns separated by tab. I want to concatenate column 1 and 2; column 3 and 4; column 5 and 6, respectively, and put a colon in between. input file: 1 0 0 1... (10 Replies)
Discussion started by: huiyee1
10 Replies

9. Shell Programming and Scripting

Concatenate two columns in a file

Hi i am having one requirement like to concatenate two columns in to one columns, can any one help on this please sample scenario i am placing below COL1,COL2,COL3,COL4 1,A,B,C,D 2,e,f,g,h ouput should be 3 columns like below. COL1,COL2,newcolumns 1,A,B,CD 2,e,f,gh ... (9 Replies)
Discussion started by: bhaskar v
9 Replies

10. Shell Programming and Scripting

How to grouping time and based on value with multiple pattern?

Hi All, need help... I have some log below : ### {"request_id":"e8395eb0-a8bd-11e9-b77b-d507ea5312aa","message":"when inquiry paybill 628524871 prevalidation cause : Invalid Transaction"} ### {"request_id":"043f2310-a8be-11e9-b57b-f9c7344998d7","message":"when inquiry paybill 62821615... (2 Replies)
Discussion started by: fajar_3t3
2 Replies
lvmadm(1M)																lvmadm(1M)

NAME
lvmadm - display limits associated with a volume group version SYNOPSIS
vg_vers] DESCRIPTION
The command is used to perform the actions below: o Display the limits associated with a volume group version. o Display the LVM configuration that is contained in and files for the indicated volume group version. o Update the entries of the bootable volume group and the boot information present in the boot disk either during or after boot. With the boot disk's physical location changing prior to reboot or when the system is booted with a cloned disk, the entries of the bootable volume group and the boot information present in the boot disk may be out of sync with the kernel. In such a situation, follow- ing root volume group activation (either during boot or post boot) use the command in migrate mode option) to update the information present in the file and the boot information present in the boot disk with the kernel. See lvm(7) for more details. Options and Arguments recognizes the following options: Display a table of limits for the indicated volume group version. Display limits or configuration for volume group version vg_vers. The default is to display limits for all supported volume group versions. Display the LVM configuration that is contained in the and files. Produce a compact listing of fields described in The output is a list of colon separated fields formatted as: Update the information present in the file for the bootable volume group and the boot information present in the boot disk, with the information present in the kernel, if there is any mismatch. Display With -t Option For each volume group version to be displayed (one if is specified, all if is omitted) displays the following. VG Version The volume group version. Max VG Size (Tbytes) The maximum size of a volume group in terabytes. Max LV Size (Tbytes) The maximum size of a logical volume in terabytes. Max PV Size (Tbytes) The maximum size of a physical volume in terabytes. Max VGs The maximum number of volume groups this volume group version supports on a system. Max LVs The maximum number of logical volumes in a volume group. Max PVs The maximum number of physical volumes in a volume group. Max Mirrors The maximum number of mirrors for a logical volume. Max Stripes The maximum number of stripes for a logical volume. Max Stripe Size (Kbytes) The maximum stripe size for a logical volume in kilobytes. Max LXs per LV The maximum number of extents in a logical volume. Max PXs per PV The maximum number of extents in a physical volume. Max Ext Size (Mbytes) The maximum size of an extent in megabytes. Display with -l Option For each volume group version to be displayed (one if is specified, all if is omitted) displays the following: o The list of volume groups that exist on the system, and o The list of physical volumes belonging to each of the volume groups. The LVM configuration displayed by this option is from data contained in the and files. The command fails if these files are missing or corrupt. Compact Listing (-F Option) The option generates a compact and parsable listing of the command output in colon separated fields formatted as The option is designed to be used by scripts. The resulting command output may be split across multiple lines. The output may include new keys and/or values in the future. If a key is deprecated, its associated value is set to Compact Listing for -t option Below is a sample output: Compact Listing for -l option Below is a sample output: EXTERNAL INFLUENCES
Environment Variables determines the language in which messages are displayed. If is not specified or is null, it defaults to "C" (see lang(5)). If any internationalization variable contains an invalid setting, all internationalization variables default to "C" (see environ(5)). EXAMPLES
Display a table of limits for volume group version 2.0. Display the LVM configuration file contents for volume group version 1.0. AUTHOR
was developed by HP. SEE ALSO
vgcreate(1M), lvm(7). lvmadm(1M)
All times are GMT -4. The time now is 01:26 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy