Extract two file contents and consolidate in the third file
Hi all
I have two files (first_file.txt) and ( second_file.txt). The first file consists of sentences line by line given as :
The second file contains details of each sentences in column fashion like: [There is a blank line in between two sentence details as given below]
There are five columns separated by a blank space for each line in the second file e.g. considering the first line:
My problem is considering the sentences of the first file, search each word of the sentences of the first file for a match in the [column4] of the corresponding location of the second file (i.e., first sentence of first file with the first details of the second file and so on]. If the word matches with column4, then pick up the entry of the first column[column1] and then write output to a third file for each word such as:
column4|column1 column4|column1 column4|column1
If there is no match found of the word of sentences of the first file with the column4 of the second file, then write the output as:
WORD|empty
[Please note : WORD is the word which is not found in the column4 of the second file]
The expected output of the above example is
I would like to write a Perl script on this problem. I have attached the sample files [first_file.txt and second_second.txt are the input files and my_final_output.txt is the expected output file]
hi,
i am trying to consolodate the files in the unix with the '>>' i have some 50 or 60 files.is there any another way of consolidating the alll 50 or 60 files in to one file. actually the way i m doing creaating the problem while loading the file with teradat tpump and fasload.
so if there is... (3 Replies)
Give shell script....which takes two file names as input and compares the contents, is both are same delete second file's contents.....
I try with "diff"...... but confusion how to use "diff" with if ---else
Thanking you (5 Replies)
Hi,
I want to delete the contents of a file which are matching with contents of other file in shell scripting.
Ex.
file1
sheel,sumit,1,2,3,4,5,6,7,8
sumit,rana,2,3,4,5,6,7,8,9
grade,pass,2,3,4,5,6,232,1,1
name,sur,33,1,4,12,3,5,6,8
sheel,pass,2,3,4,5,6,232,1,1
File2... (3 Replies)
Hi
i would like to extract some part of the file to a new file.
first I would like to search for a string in the file and then i want two or three line above from the string to the the required string(can be any character)
I would like this to be made generalized in a script
Thanks (5 Replies)
Hi,
I am facing issue while reading data from a file in UNIX. my requirement is to compare two files and for the text pattern matching in the 1st file, replace the contents in second file by the contents of first file from start to the end and write the contents to thrid file.
i am able to... (2 Replies)
Hi I have to file in with 1 similar colomn.
from both files i want similar values from column1 and col2 from file1 and col2 from file2 in file 3
file1
colomn 1 colomn2
rmoved (8 Replies)
Hi one of the output of the command is as below
# sed -n "/CCM-ResourceHealthCheck:/,/---------/{/CCM-ResourceHealthCheck:/d;/---------/d;p;}" Automation.OutputZ$zoneCounter | sed 's/$/<br>/'
Resource List : <br>
*************************** 1. row ***************************<br>
... (2 Replies)
Consolidate several lines of a CSV file with firewall rules
Hi guys.
I have a CSV file, which I created using an HTML export from a Check Point firewall policy.
Each rule is represented as several lines, in some cases. That occurs when a rule has several address sources, destinations or... (4 Replies)
Shell script logic
Hi
I have 2 input files like with file 1 content as (file1)
"BRGTEST-242" a.txt "BRGTEST-240" a.txt "BRGTEST-219" e.txt
File 2 contents as fle(2)
"BRGTEST-244" a.txt "BRGTEST-244" b.txt "BRGTEST-231" c.txt "BRGTEST-231" d.txt "BRGTEST-221" e.txt
I want to get... (22 Replies)