0

For instance, I have a data like below:

Transmit.123 Invite Members A
Transmit.123 Invite Members GC
Transmit.111 Invite Members F
Transmit.222 Invite Members DE
Transmit.222 Invite Members H
Transmit.333 Invite Members M
Transmit.333 Invite Members KL

Output should file should have below data:

Transmit.123 Invite Members AGC
Transmit.222 Invite Members DEH
Transmit.333 Invite Members MKL
  • 2
    What about Transmit.111? Why don't you want to see that one? – glenn jackman Jun 17 at 16:06
  • yeah I can do other way around also, where I keep unique rows and put duplicate rows (entirely, origin plus copy) in another file. Transmit.111 is also required but my big concern is to combine the values of column 4 of one which have duplicate columns.1 values. – Shivani Jun 18 at 14:23
1

Something like this:

cat file |
  perl -ne '/(Transmit.\d+ Invite Members )(.*)/ and $a{$1}.=$2;
      END { print map { $_,$a{$_},"\n" } sort keys %a }'
  • no luck with above command! – Shivani Jun 17 at 16:41
  • @Shivani, what's wrong with it? It looks to me like it does what you need. – glenn jackman Jun 18 at 16:41

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.