Skip to main content
added 31 characters in body; edited title
Source Link
jimmij
  • 48.7k
  • 20
  • 136
  • 141

awk to compare Compare two files and matchwith awk

I'm trying to compare two files and print the output if they match on fieldsome fields.

File1.txt:

bart:29482164591748
 apu:29482164591748
smithers:68468468468464
lisa:68468468468464
maggie:2348578903247548

File2.txt:

68468468468464:keyboard
68463894578424:user
29482164591748:computer

I would like this output:

bart:29482164591748:computer

awk to compare two files and match

I'm trying to compare two files and match on field

File1.txt:

bart:29482164591748
 apu:29482164591748
smithers:68468468468464
lisa:68468468468464
maggie:2348578903247548

File2.txt:

68468468468464:keyboard
68463894578424:user
29482164591748:computer

I would like this output:

bart:29482164591748:computer

Compare two files with awk

I'm trying to compare two files and print the output if they match on some fields.

File1.txt:

bart:29482164591748
 apu:29482164591748
smithers:68468468468464
lisa:68468468468464
maggie:2348578903247548

File2.txt:

68468468468464:keyboard
68463894578424:user
29482164591748:computer

I would like this output:

bart:29482164591748:computer
added 25 characters in body
Source Link

I'm trying to compare two files and match on field

File1.txt:

bart:29482164591748
 apu:29482164591748
smithers:68468468468464
lisa:68468468468464
maggie:2348578903247548

File2.txt:

68468468468464:keyboard
68463894578424:user
29482164591748:computer

I would like this output:

bart:29482164591748:computer

I'm trying to compare two files and match on field

File1.txt:

bart:29482164591748
smithers:68468468468464
lisa:68468468468464
maggie:2348578903247548

File2.txt:

68468468468464:keyboard
68463894578424:user
29482164591748:computer

I would like this output:

bart:29482164591748:computer

I'm trying to compare two files and match on field

File1.txt:

bart:29482164591748
 apu:29482164591748
smithers:68468468468464
lisa:68468468468464
maggie:2348578903247548

File2.txt:

68468468468464:keyboard
68463894578424:user
29482164591748:computer

I would like this output:

bart:29482164591748:computer
deleted 1 character in body
Source Link

I'm trying to compare two files and match on field one on file one and field two on file two.

File1.txt:

68468468468464bart:keyboard29482164591748
68463894578424smithers:user68468468468464
29482164591748lisa:computer68468468468464
maggie:2348578903247548

File2.txt:

bart68468468468464:29482164591748keyboard
smithers68463894578424:68468468468464user
lisa29482164591748:68468468468464computer

I would like this output:

bart:29482164591748:computer

I'm trying to compare two files and match on field one on file one and field two on file two.

File1.txt:

68468468468464:keyboard
68463894578424:user
29482164591748:computer

File2.txt:

bart:29482164591748
smithers:68468468468464
lisa:68468468468464

I would like this output:

bart:29482164591748:computer

I'm trying to compare two files and match on field

File1.txt:

bart:29482164591748
smithers:68468468468464
lisa:68468468468464
maggie:2348578903247548

File2.txt:

68468468468464:keyboard
68463894578424:user
29482164591748:computer

I would like this output:

bart:29482164591748:computer
Thanks and please are implied here. Please only ask the question.
Source Link
terdon
  • 252.2k
  • 69
  • 480
  • 718
Loading
added 21 characters in body; edited tags
Source Link
terdon
  • 252.2k
  • 69
  • 480
  • 718
Loading
Source Link
Loading