I sorted the output from conflicting numbers that are already existing in my DB with new insert request to a file name output. This is the output of the file.
cat output
DataBase: (9999999999) NewDB_insert: (999-999-9999)
DataBase: (1111111111) NewDB_insert: (111-111-1111)
DataBase: (2222222222) NewDB_insert: (222-222-2222)
DataBase: (3333333333) NewDB_insert: (333-333-3333)
I want to run the same command that displays information from the same line that has the conflict. The command just pulls the DB information.
showinfo -id 9999999999
ID:9999999999
Name: Mr.Brown
City: New York
Company: Acme
Client: 1245
showinfo -id 999-999-9999
ID:999-999-9999
Name: Mr.Brown
City: New York
Company: Acme
Client: 1245
I want to use 2 variables to send the output to the screen from my file named output. So I would have the following information from my file.
**From DB:**
ID:9999999999
Name: Mr.Brown
City: New York
Company: Acme
Client: 1245
**From NewDB_insert:**
showinfo -id 999-999-9999
ID:999-999-9999
Name: Mr.Brown
City: New York
Company: Acme
Client: 1245
So basically I would cat the file in a for loop with one variable as so.
for i in `cat output | awk '{print $2}' | tr -d ")("`;do echo == From DB:==;showinfo -id $i; echo ==========;done
Which gives me the first part of what I need. I looked online and not able to use any examples to create a for loop with 2 variables. Any help would be appreciated.