05-30-2012
Grouping or appending the lines in a file through Unix
Hi,
I am looking for a way to Group the Lines in a file.. Basically My file structure is something like this
A 1 100 abc def
A 1 200 abc def
A 1 300 abc def
A 2 100 pqr def
A 2 200 pqr def
A 2 300 pqr def
A 1 100 abc def
A 1 200 xyz def
A 1 300 xyz def
I need it as shown below, Its Just to Group All 1s in the 2nd field
A 1 100 abc def
A 1 200 abc def
A 1 300 abc def
A 1 100 abc def
A 1 200 xyz def
A 1 300 xyz def
A 2 100 pqr def
A 2 200 pqr def
A 2 300 pqr def
It would be really great if you can tell me a logic to regroup and remove certain unwanted or duplicate record in the 2nd occurence.. If you see above you can find that "A 1 100 abc def " is repeated twice... I would neeed an output like this
A 1 100 abc def
A 1 200 abc def
A 1 300 abc def
A 1 200 xyz def
A 1 300 xyz def
A 2 100 pqr def
A 2 200 pqr def
A 2 300 pqr def
Let me know if someone has idea on these lines
10 More Discussions You Might Find Interesting
1. Shell Programming and Scripting
Is there a way to combine two lines onto a single line...append the following line onto the previous line?
I have the following file that contains some blank lines and some lines I would like to append to the previous line...
current file:
checking dsk c19t2d6
checking dsk c19t2d7
... (2 Replies)
Discussion started by: mr_manny
2 Replies
2. Shell Programming and Scripting
I have file like this
d123, rahim, 140
d123, rahul, 440
d123, begum, 340
d234, bajaj, 755
d234, gajal, 657
I want to group this file like this
d123, rahim, 140
rahul, 440
begum, 340
d234, bajaj, 755
gajal, 657
can any one help me on this
thanks in advance (8 Replies)
Discussion started by: trichyselva
8 Replies
3. Shell Programming and Scripting
Hello All,
I have a small problem with file group/splitting and I am trying to get the best way to perform this in unix. I am trying with awk but need some suggestion what would be the best and fastest way to-do it.
Here is the problem. I have a fixed length file with filled with product... (4 Replies)
Discussion started by: nandhan11891
4 Replies
4. UNIX for Advanced & Expert Users
Hi all,
I have input lines like below:
A;100;Paris;City;10;0;0
A;100;Paris;City;0;10;0
A;100;Paris;City in Europe;0;0;20
B;101;London;City;20;0;0
B;101;London;City;0;20;0
B;101;London;City in Europe;0;0;40
I need to group the above lines to:
A;100;Paris;City in Europe;10;10;20... (4 Replies)
Discussion started by: andy2000
4 Replies
5. Shell Programming and Scripting
Whats a good way to group (by adding a new integer to the front of each line) pairs of lines, such that lines 1 & 2 are group 1, lines 3 & 4 are group 2, etc...
ex input:
A
B
C
D
etc...
ex output:
1A
1B
2C
2D
etc... (5 Replies)
Discussion started by: watingo
5 Replies
6. Shell Programming and Scripting
I am having 6 files named file1,file2....file6 and i need to append number of lines in each file to begining of the file. For example,
If file 1 contains
a
b
c
d
then after adding new line file1 should contain
4
a
b
c
d
Thanks in advance. (2 Replies)
Discussion started by: akhay_ms
2 Replies
7. Shell Programming and Scripting
Hi all,
I have a file with some number of lines. I need to add certain number of lines from another file which may vary according to the user's input and to it.
eg
code:
I/P
file 1
apps/file/xyz
apps/file/abc
apps/file/def
file 2
progs/file/xyz
... (2 Replies)
Discussion started by: Ananthdoss
2 Replies
8. UNIX for Dummies Questions & Answers
Hi,
I am looking for a way to Group the Lines in a file.. Basically My file structure is something like this
A 1 100 abc def
A 1 200 abc def
A 1 300 abc def
A 2 100 pqr def
A 2 200 pqr def
A 2 300 pqr def
A 1 100 abc def
A 1 200 xyz def
A 1 300 xyz def
I need it as... (6 Replies)
Discussion started by: mkandula1983
6 Replies
9. Shell Programming and Scripting
Hi Friends,
I am working on a file which has content as follows
Wed,Database,ABC_cube,loaded
Wed,Logging,out,user,302002654,active,for,0,minutes
Wed,Logging,out,user,109000151,active,for,8,minutes
Wed,Logging,out,user,302002654,active,for,0,minutes... (8 Replies)
Discussion started by: dev.devil.1983
8 Replies
10. Shell Programming and Scripting
Hello,
I have a file like:
str1,"HEX"H,(39),info
str2,"HEX"H,(854548),info
str3,"HEX"H,'BGTOUR',info
str4,"HEX"H,(534322),info
str1,"HEX"H,,info
str3,"HEX"H,'Landing',info
str4,"HEX"H,'BG',info
str1,"HEX"H,,info
str3,"HEX"H,'Ay',info
str1,"HEX"H,(27),info
str2,"HEX"H,(854548),info... (2 Replies)
Discussion started by: apenkov
2 Replies
LEARN ABOUT DEBIAN
hhfilter
HHFILTER(1) User Commands HHFILTER(1)
NAME
hhfilter - filter an alignment by maximum sequence identity of match states and minimum coverage
SYNOPSIS
hhfilter -i infile -o outfile [options]
DESCRIPTION
HHfilter version 2.0.15 (June 2012) Filter an alignment by maximum sequence identity of match states and minimum coverage (C) Johannes
Soeding, Michael Remmert, Andreas Biegert, Andreas Hauser Remmert M, Biegert A, Hauser A, and Soding J. HHblits: Lightning-fast iterative
protein sequence searching by HMM-HMM alignment. Nat. Methods 9:173-175 (2011).
-i <file>
read input file in A3M/A2M or FASTA format
-o <file>
write to output file in A3M format
-a <file>
append to output file in A3M format
OPTIONS
-v <int>
verbose mode: 0:no screen output 1:only warings 2: verbose
-id [0,100] maximum pairwise sequence identity (%) (def=90)
-diff [0,inf[
filter MSA by selecting most diverse set of sequences, keeping at least this many seqs in each MSA block of length 50 (def=0)
-cov [0,100] minimum coverage with query (%) (def=0)
-qid [0,100] minimum sequence identity with query (%) (def=0)
-qsc [0,100] minimum score per column with query (def=-20.0)
-neff [1,inf]
target diversity of alignment (default=off)
Input alignment format:
-M a2m use A2M/A3M (default): upper case = Match; lower case = Insert; '-' = Delete; '.' = gaps aligned to inserts (may be omitted)
-M first
use FASTA: columns with residue in 1st sequence are match states
-M [0,100]
use FASTA: columns with fewer than X% gaps are match states
Example: hhfilter -id 50 -i d1mvfd_.a2m -o d1mvfd_.fil.a2m
hhfilter 2.0.15 June 2012 HHFILTER(1)