I have a file with two fields in it delimited by a comma. Some of the first fields are duplicates. I am trying to eliminate any duplicate records in the first field, and combine the second fields in the output file.
For example, if the input is:
I want the output to be:
I've tried numerous combinations of join and sort -u with keys, etc, but can't get the desired result.
Thanks
Last edited by vgersh99; 05-20-2015 at 01:26 PM..
Reason: code tags, please
Is it possible to do a join on multiple fields of two files? I am trying to do something like join -t, -1 2,3 -2 2,3 -o 2.1,2.2,2.3,1.3 filea fileb
I want the join to be on columns 2 and 3 of filea and columns 2 and 3 of fileb.
What is hapenning is that the second file that I want to do the join... (1 Reply)
i wanna combine 2 files that need to use join(need to use -a1 -a2) to produce a new file and also need to sort the new file in numerical order by ID.
The format of 2 files is:
Filename: Prac1
# Results for Prac1. The format is:
# 12345677 10
20693680 10
20179687 9
20781637 5
21907894 6
... (1 Reply)
Hi Guys,
I have a file as follows:
1 2 3
There are 5 spaces between 1 and 2 and one space between 2 and 3.
I want:
123
How can I do this using awk?
I tried using: (8 Replies)
Hi, I need help with the join command
I have 2 files that I want to join on multiple fields.
I want to return all records from file 1
I also want empty fields in my joined file if there isn't a match in file 2
I have already sorted them so I know they are in the same order.
file1 ... (0 Replies)
My input is as below:
1|2|3|a02 test|303
2|2|4|1002 a05 ind|303
4|3|5|ind|30
Output
1|2|3|a02test|303
2|2|4|a05ind|303
4|3|5|ind|30
I used command:
I am getting above output. Is there any simple way using awk to acheive this.
Thanks.
Please use code tags! (6 Replies)
Hi All,
I am looking for an awk script to do the following
Join the fields together only if the first 4 fields are same.
Can it be done with join function in awk??
a,b,c,d,8,,,
a,b,c,d,,7,,
a,b,c,d,,,9,
a,b,p,e,8,,,
a.b,p,e,,9,,
a,b,p,z,,,,9
a,b,p,z,,8,,
desired output:
... (1 Reply)
Hi
I have a file as below
<field1> <field2> <field3> ... <field_num1> <field_num2>
Trying to sort based on difference of <field_num1> and <field_num2> in desceding order and print all fields.
I tried this and it doesn't sort on the difference field .. Appreciate your help.
cat... (9 Replies)
Hi All,
Seeking for your assistance on how to combine two fields if there's a comma between them.
What i did was, extract the records from database.
file1.csv(extracted from db)
82|Supplies Station, Inc.|112012|KARISSA APPAREL, INC. - 112012|NON TRADE F/A AND... (2 Replies)
Discussion started by: znesotomayor
2 Replies
LEARN ABOUT REDHAT
groupmod
GROUPMOD(8) System Manager's Manual GROUPMOD(8)NAME
groupmod - Modify a group
SYNOPSIS
groupmod [-g gid [-o]] [-n group_name ] group
DESCRIPTION
The groupmod command modifies the system account files to reflect the changes that are specified on the command line. The options which
apply to the groupmod command are
-g gid The numerical value of the group's ID. This value must be unique, unless the -o option is used. The value must be non-negative.
Values between 0 and 99 are typically reserved for system groups. Any files which the old group ID is the file group ID must have
the file group ID changed manually.
-n group_name
The name of the group will be changed from group to group_name.
FILES
/etc/group - group information
/etc/gshadow - secure group information
SEE ALSO chfn(1), chsh(1), passwd(1), groupadd(8), groupdel(8), useradd(8), userdel(8), usermod(8)AUTHOR
Julianne Frances Haugh (jockgrrl@ix.netcom.com)
GROUPMOD(8)