Skip to main content

All Questions

Tagged with
-1 votes
1 answer
59 views

Returning lines from a JSON log file which contain IP and timestamps read from a CSV file?

so I'm new to Shell Scripting and could use some help. So in my CSV file, I want to see if IP and timestamp values exists in some way in the line entries of the JSON log file, and if so, return that ...
Linuxnoob's user avatar
0 votes
2 answers
2k views

Merge all csv files in directory column wise

Say the directory contained 3 csv files: The first csv: Name, John Age, 18 The second csv: Name, Jim Age, 21 The third csv: Name, Amy Age, 22 I would want the result to be: Name, John, Jim, Amy Age,...
Tap's user avatar
  • 35
0 votes
1 answer
1k views

How to selectively join lines starting with a pattern [duplicate]

This post may be looked upon as a followup to a previous post. This is input file: module ABC x(a,b,c) module DEFG y(d,e,f, g,h,i) module HIJKL z(j,k,l) And output file should be: module ...
Sandeep's user avatar
  • 139
1 vote
2 answers
3k views

How to join 2 files based one key and selected some specific column?

I have 2 files and want to inner join them using awk. This is written using sql server : SELECT [file1.column1],[file2.column2] FROM file1 INNER JOIN file2 on file2.column1 = file1.column5; This is ...
Onta Ss's user avatar
  • 13
0 votes
2 answers
494 views

Merge CSV Files based on ID even when Unmatched IDS and Indefinite Number of Columns

I'm writing a bash script and part of the process requires to piece csv files together whilst preserving the integrity of the columns; for example I have two files in the following format: F1 ID,MD,...
madArch's user avatar
  • 97
0 votes
0 answers
148 views

how to merge two files to skip duplicate data

I have two different large files (each one more than 300,000 lines) and I want to combine them in a specific way. Some rows of the two data measure the same thing; when columns 9, 14, 15, 16, 17 are ...
Esi's user avatar
  • 5
0 votes
1 answer
65 views

Merge two texts with comparison of the rows and select one text's rows if some columns are similar

I have two different files which some rows of the two data measures a same thing. I want to have a merged output such that the rows of File1 will be the output row where the rows measures same thing (...
Esi's user avatar
  • 5
1 vote
2 answers
3k views

Joining two csv files on common column and removing the second last column

I have two csv files: file1: C1, 1, 0, 1, 0, 1 C2, 1, 0, 1, 1, 0 C3, 0, 0, 1, 1, 0 file2: C3, 1.2 C1, 2.3 C2, 1.8 I want to merge these two files based on C column (which produces): C1, 1, 0, 1, 0,...
Coder's user avatar
  • 179
3 votes
2 answers
5k views

Merge some tab-delimited files

I have 100 files with 57,816 rows each.I want to do an outer join of these files by merging on basis of the common column. I am using R programming for this but this is very slow. fileList <- ...
Ron's user avatar
  • 1,087
4 votes
3 answers
6k views

Comparing files line by line in awk with delimiter

file1: abc|123|check def|456|map ijk|789|globe lmn|101112|equator file2: abc|123|check def|456|map ijk|789|equator lmn|101112|globe EXPECTED OUTPUT: ijk|789|equator lmn|101112|globe Current awk ...
user1502952's user avatar
9 votes
5 answers
18k views

Compare two files with first column and remove duplicate row from 2nd file in shell script

I will ask my question with an example. I have 2 files: File #1: 118D FC300_R5_TP FX.B 32775 2112 6 2038 6 2112 0 118E FC300_R5_TP FX.B 32775 2136 7 ...
Rahul Rana's user avatar
9 votes
5 answers
4k views

Joining two files with unique identifier

I have two files with approximately 12900 and 4400 entries respectively, that I want to join. The files contain location information for all landbased weather observing stations around the globe. The ...
Staffan Scherloff's user avatar
4 votes
2 answers
6k views

How to find out common elements between two files?

For an example, I have 2 files having following info: File #1: 12 13 14 15 File #2: 12 1 13 2 14 2 15 6 16 7 17 8 Output File: 1 2 2 6 In the output file, I want only the second column values of ...
N. F.'s user avatar
  • 2,259
3 votes
1 answer
1k views

merging files and getting column values based on id field

bash-3.2$ cat sample.log sample.log.1 sample.log.2 ID COL1 COL2 COL4 1 col1 col2 col4 2 c1 c2 c4 3 co1 co2 co4 ID COL3 COL1 1 col3 col1 2 c3 c1 3 co3 co1 ID COL1 COL2 COL3 1 col1 ...
user avatar