bash and shell programming is new for me.I have a few files with the extension .v.gz, in the bash command I am performing some operations, and ill store the result in the same filename with .txt extension.
For the example .txt file data as shown below, I am considering 4 files with different file names, and the same extension (Maybe the file will be 30+ also)
file_one.txt
statement_modeule_name_1
statement_modeule_name_2
statement_modeule_name_3
statement_modeule_name_4
statement_modeule_name_5
Fetch_Data.txt
statement_modeule_name_6
statement_modeule_name_7
statement_modeule_name_2
statement_modeule_name_8
statement_modeule_name_9
onefile.txt
statement_modeule_name_10
statement_modeule_name_11
statement_modeule_name_6
statement_modeule_name_4
statement_modeule_name_14
Data_New.txt
statement_modeule_name_15
statement_modeule_name_16
statement_modeule_name_11
statement_modeule_name_5
statement_modeule_name_17
The output of the code expected in the command prompt
file_one and Fetch_Data statement_modeule_name_2
Fetch_Data and one_file statement_modeule_name_6
file_one and Fetch_Data statement_modeule_name_4
file_one and Fetch_Data and file4 statement_modeule_name_5
Fetch_Data and Data_new statement_modeule_name_11
The code that I am doing is
for file in *.v.gz;
do
zgrep -A1 "^module" "$file" | sed -n -e 's/^\(module \)*\(.*(.*)\).*$/\2/p' | cut -f1 -d"(" > $(basename "$file" .v.gz).txt
done #the result what I get here I mentioned in the question .txt files with data (example)
can anyone help me to complete this, I am okay with python or bash script (for bash need to remove the python extension )
- Now I am generating multiple output files with .txt format in the 1st phase
- now I want to compare multiple .txt files line by line and return if the same lines are present in the files with the filename, Shown in the output expected