Skip to main content
added 6 characters in body
Source Link
zara
  • 1.3k
  • 3
  • 15
  • 24

I have a data file looks like :

file1: c1.212 3.4 90 c1.011 4.4 33 c2.09432 7.7 76 c3.0911 8.3 83 c3.1121 4.3 23 c3.2223 2.2 22 c3.1211 2.2 12 c4.1211001 1.2 11 c4.1111222 1.2 10 c4.0000011 99 76 c5.123 11 01 c5.113 11 01 ... 

and the second file looks like:

c1.212 c3.2223 c3.0911 c5.113 ... 

as you see in file 1 based on information in the first column, there are 5 groups (c1, c2, c3, c4 and c5) and each gruop has different number of subsets( for example c1 has 2 subsets but c2 has one subset), but in the second file there are 3 groups(c1, c3 and c5). What I want is if any group that is observed in file2, to remain in file 1 with all its subsets and those groups wich are not observed in file 2 (c1 and c4), to get removed from file1 with all their subsets. therefore the output should look like:

output: c1.212 343.4 90 c1.011 444.4 33 c3.0911 838.3 83 c3.1121 434.3 23 c3.2223 222.2 22 c3.1211 222.2 12 c5.123 11 01 c5.113 11 01 ... 

Any suggestion would be appreciated.( the real file has more than 45,000 rows)

I have a data file looks like :

file1: c1.212 3.4 90 c1.011 4.4 33 c2.09432 7.7 76 c3.0911 8.3 83 c3.1121 4.3 23 c3.2223 2.2 22 c3.1211 2.2 12 c4.1211001 1.2 11 c4.1111222 1.2 10 c4.0000011 99 76 c5.123 11 01 c5.113 11 01 ... 

and the second file looks like:

c1.212 c3.2223 c3.0911 c5.113 ... 

as you see in file 1 based on information in the first column, there are 5 groups (c1, c2, c3, c4 and c5) and each gruop has different number of subsets( for example c1 has 2 subsets but c2 has one subset), but in the second file there are 3 groups(c1, c3 and c5). What I want is if any group that is observed in file2, to remain in file 1 with all its subsets and those groups wich are not observed in file 2 (c1 and c4), to get removed from file1 with all their subsets. therefore the output should look like:

output: c1.212 34 90 c1.011 44 33 c3.0911 83 83 c3.1121 43 23 c3.2223 22 22 c3.1211 22 12 c5.123 11 01 c5.113 11 01 ... 

Any suggestion would be appreciated.( the real file has more than 45,000 rows)

I have a data file looks like :

file1: c1.212 3.4 90 c1.011 4.4 33 c2.09432 7.7 76 c3.0911 8.3 83 c3.1121 4.3 23 c3.2223 2.2 22 c3.1211 2.2 12 c4.1211001 1.2 11 c4.1111222 1.2 10 c4.0000011 99 76 c5.123 11 01 c5.113 11 01 ... 

and the second file looks like:

c1.212 c3.2223 c3.0911 c5.113 ... 

as you see in file 1 based on information in the first column, there are 5 groups (c1, c2, c3, c4 and c5) and each gruop has different number of subsets( for example c1 has 2 subsets but c2 has one subset), but in the second file there are 3 groups(c1, c3 and c5). What I want is if any group that is observed in file2, to remain in file 1 with all its subsets and those groups wich are not observed in file 2 (c1 and c4), to get removed from file1 with all their subsets. therefore the output should look like:

output: c1.212 3.4 90 c1.011 4.4 33 c3.0911 8.3 83 c3.1121 4.3 23 c3.2223 2.2 22 c3.1211 2.2 12 c5.123 11 01 c5.113 11 01 ... 

Any suggestion would be appreciated.( the real file has more than 45,000 rows)

added 73 characters in body
Source Link
zara
  • 1.3k
  • 3
  • 15
  • 24

I have a data file looks like :

file1: c1.212 343.4 90 c1.011 444.4 33 c2.09432 777.7 76 c3.0911 838.3 83 c3.1121 434.3 23 c3.2223 222.2 22 c3.1211 222.2 12 c4.1211001 121.2 11 c4.1111222 121.2 10 c4.0000011 99 76 c5.123 11 01 c5.113 11 01 ... 

and the second file looks like:

c1.212 c3.2223 c3.0911 c5.113 ... 

as you see in file 1 based on information in the first column, there are 5 groups (c1, c2, c3, c4 and c5) and each gruop has different number of subsets( for example c1 has 2 subsets but c2 has one subset), but in the second file there are 3 groups(c1, c3 and c5). What I want is if any group that is observed in file2, to remain in file 1 with all its subsets and those groups wich are not observed in file 2 (c1 and c4), to get removed from file1 with all their subsets. therefore the output should look like:

output: c1.212 34 90 c1.011 44 33 c3.0911 83 83 c3.1121 43 23 c3.2223 22 22 c3.1211 22 12 c5.123 11 01 c5.113 11 01 ... 

Any suggestion would be appreciated.( the real file has more than 45,000 rows)

I have a data file looks like :

file1: c1.212 34 90 c1.011 44 33 c2.09432 77 76 c3.0911 83 83 c3.1121 43 23 c3.2223 22 22 c3.1211 22 12 c4.1211001 12 11 c4.1111222 12 10 c4.0000011 99 76 c5.123 11 01 c5.113 11 01 

and the second file looks like:

c1.212 c3.2223 c3.0911 c5.113 

as you see in file 1 based on information in the first column, there are 5 groups (c1, c2, c3, c4 and c5) and each gruop has different number of subsets( for example c1 has 2 subsets but c2 has one subset), but in the second file there are 3 groups(c1, c3 and c5). What I want is if any group that is observed in file2, to remain in file 1 with all its subsets and those groups wich are not observed in file 2 (c1 and c4), to get removed from file1 with all their subsets. therefore the output should look like:

output: c1.212 34 90 c1.011 44 33 c3.0911 83 83 c3.1121 43 23 c3.2223 22 22 c3.1211 22 12 c5.123 11 01 c5.113 11 01 

Any suggestion would be appreciated.

I have a data file looks like :

file1: c1.212 3.4 90 c1.011 4.4 33 c2.09432 7.7 76 c3.0911 8.3 83 c3.1121 4.3 23 c3.2223 2.2 22 c3.1211 2.2 12 c4.1211001 1.2 11 c4.1111222 1.2 10 c4.0000011 99 76 c5.123 11 01 c5.113 11 01 ... 

and the second file looks like:

c1.212 c3.2223 c3.0911 c5.113 ... 

as you see in file 1 based on information in the first column, there are 5 groups (c1, c2, c3, c4 and c5) and each gruop has different number of subsets( for example c1 has 2 subsets but c2 has one subset), but in the second file there are 3 groups(c1, c3 and c5). What I want is if any group that is observed in file2, to remain in file 1 with all its subsets and those groups wich are not observed in file 2 (c1 and c4), to get removed from file1 with all their subsets. therefore the output should look like:

output: c1.212 34 90 c1.011 44 33 c3.0911 83 83 c3.1121 43 23 c3.2223 22 22 c3.1211 22 12 c5.123 11 01 c5.113 11 01 ... 

Any suggestion would be appreciated.( the real file has more than 45,000 rows)

Source Link
zara
  • 1.3k
  • 3
  • 15
  • 24

how to keep a part of rows within a file based on information in a second file?

I have a data file looks like :

file1: c1.212 34 90 c1.011 44 33 c2.09432 77 76 c3.0911 83 83 c3.1121 43 23 c3.2223 22 22 c3.1211 22 12 c4.1211001 12 11 c4.1111222 12 10 c4.0000011 99 76 c5.123 11 01 c5.113 11 01 

and the second file looks like:

c1.212 c3.2223 c3.0911 c5.113 

as you see in file 1 based on information in the first column, there are 5 groups (c1, c2, c3, c4 and c5) and each gruop has different number of subsets( for example c1 has 2 subsets but c2 has one subset), but in the second file there are 3 groups(c1, c3 and c5). What I want is if any group that is observed in file2, to remain in file 1 with all its subsets and those groups wich are not observed in file 2 (c1 and c4), to get removed from file1 with all their subsets. therefore the output should look like:

output: c1.212 34 90 c1.011 44 33 c3.0911 83 83 c3.1121 43 23 c3.2223 22 22 c3.1211 22 12 c5.123 11 01 c5.113 11 01 

Any suggestion would be appreciated.