I want to combine 2 files and and put together in 1 file [ only 2 fields ($4 and $5 in FILE A, $2 and $3 in FILE B) are the common thing between the two files]. See below desired output. Any help will be much appreciated.
FILE AFILE B
_______________________________ RESULT
Thanks in advance!
Moderator's Comments:
Please use CODE tags around all sample input, sample output, and code segments; not just around filenames.
Last edited by Don Cragun; 04-08-2016 at 06:20 PM..
Reason: Fix CODE and ICODE tags.
Welcome to forums, please use code tags for complete Input_file and sample outputs into posts as per forums rules. Here are some points which are not clear into your request.
I- Number of lines into filea and fileb are NOT same, so how comparison should happen?
II- IN case it should be by filea's $4 and $5 and fileb's $2 and $3(as per your post) then also there is a question, let's say we have following scenario where same values of $4 and $5 have more than one values into it then which value we should print?
It is advisable to please describe your requirement little more with sample Input_file and expected Output_file. Anyways based on few wild assumptions following you could take as a startup for this problem.
Output will be as follows.
Please get back to us in case of any queries on same.
Do not post classroom or homework problems in the main forums. Homework and coursework questions can only be posted in this forum under special homework rules.
Please review the rules, which you agreed to when you registered, if you have not already done so.
More-than-likely, posting homework in the main forums has resulting in a forum infraction. If you did not post homework, please explain the company you work for and the nature of the problem you are working on.
I am on linux red hat, want to use the logic within bash shell script file.
I have the following type, named files in folder /staging, want to move with new filename just the firstpart upto underscore, example 20180904105056.dat, how can i get upto first part of filename and validate to chk if... (2 Replies)
I have two directories called English and Hindi. Each directory contains the same number of files with the only difference being that in the case of the English Directory the tag is
.english
and in the Hindi one the tag is
.Hindi
The file may contain either a single text or more than one text... (7 Replies)
Hello,
I have a file with 2 columns ( tableName , ColumnName) delimited by a Pipe like below . File is sorted by ColumnName.
Table1|Column1
Table2|Column1
Table5|Column1
Table3|Column2
Table2|Column2
Table4|Column3
Table2|Column3
Table2|Column4
Table5|Column4
Table2|Column5
From... (6 Replies)
Can anyone please help me i have 2 text files setup like the one below.
Textfile1:
randomemail1:randompassword1
randomemail2:randompassword2
randomemail3:randompassword3
randomemail4:randompassword4
randomemail5:randompassword5
Textfile2:
randompassword1:randomphrase1... (8 Replies)
Hi,
I have 20 tab delimited text files that have a common column (column 1). The files are named GSM1.txt through GSM20.txt. Each file has 3 columns (2 other columns in addition to the first common column).
I want to write a script to join the files by the first common column so that in the... (5 Replies)
Hello,
My apologies if this has been posted elsewhere, I have had a look at several threads but I am still confused how to use these functions. I have two files, each with 5 columns:
File A: (tab-delimited)
PDB CHAIN Start End Fragment
1avq A 171 176 awyfan
1avq A 172 177 wyfany
1c7k A 2 7... (3 Replies)
I want to compare "N" (around 2000+) number of huge files located in a directory A against "N" files located in a different directory using Bash scripting.
Please help me with any scripts available.
Thanks. (2 Replies)
Hi
Im new to BASH scripting, I have created a simple script
#! /bin/sh
LOCAL=/home/scanner
NOW=$(date +"%b-%d-%y")
LOGFILE="log-$NOW.log"
cd $LOCAL
echo 'Start';
echo $LOGFILE
touch $LOGFILE (2 Replies)