Understanding Text Comparison Methods

Asked 2 years ago, Updated 2 years ago, 76 views

Thank you for your help.I'd like to create a script that compares all the arrays and texts.

Example)

 a.txt
-----
a
B
c
d

1.txt
-----
1
2
3
4

This is a-1, a-2, a-3, a-4, b, 1, -b, 2-b, 3, b-4
I'd like to compare it with the image of a sash-kake in the form of
I couldn't come up with an idea.

Could someone please let me know the sample?

I only know powershell and shell, so I'm sorry, but please let me know within that range.

Thank you for your cooperation.

powershell shell

2022-09-30 16:22

3 Answers

I wonder if comparison is like this.

cata.txt | while read LINE_A
do
  cat1.txt | while read LINE_1
  do
    printf "${LINE_A} and ${LINE_1}"
    printf "Comparison"
    if ["${LINE_A}"="${LINE_1}"] 
    then
      printf "Same thing"
    else
      printf "Something Different"
    fi
    It was echo.
  done
done


2022-09-30 16:22

join-j65535-t"-"a.txt1.txt | sed-e"s/^-//">merge.txt

Supplement to emasaka's response.
Specify delimiter and delete delimiter at the beginning of the line and output it to a file


2022-09-30 16:22

For Linux, if you specify a column that does not exist in the join command, you get a combination of lines of text.

$join-j100 a.txt1.txt
 a1
 a2
 a3
 a4
 b1
 b2
 b3
 b4
 c1
 c2
 c3
 c4
 d1
 d2
 d3
 d4

"I don't know exactly what ""comparison"" does, so that's it for now."


2022-09-30 16:22

If you have any answers or tips


© 2024 OneMinuteCode. All rights reserved.