Timeline for Intersection of two files based on two columns and one condition
Current License: CC BY-SA 4.0
11 events
| when toggle format | what | by | license | comment | |
|---|---|---|---|---|---|
| Sep 15, 2021 at 13:05 | comment | added | Ed Morton | None of those scripts would print the header line shown in the expected output and you never need a pipe to grep when you're using awk. | |
| Sep 15, 2021 at 11:32 | comment | added | shaola | Just in case you missed: | grep "Stef" will filter all the lines do not contains Stef | grep "^Stef" will filter all the lines do not start with Stef | |
| Sep 15, 2021 at 11:23 | comment | added | John | Yes both of the solutions work. Thank you! | |
| Sep 15, 2021 at 11:23 | vote | accept | John | ||
| Sep 15, 2021 at 10:02 | history | edited | shaola | CC BY-SA 4.0 | added 1 character in body |
| Sep 15, 2021 at 9:50 | history | edited | shaola | CC BY-SA 4.0 | added 237 characters in body |
| Sep 15, 2021 at 9:49 | comment | added | shaola | How about this? awk 'NR==FNR{A[$1];next}$2 in A' file2.txt file1.txt | grep "Stef" | |
| Sep 15, 2021 at 9:45 | history | edited | shaola | CC BY-SA 4.0 | added 237 characters in body |
| Sep 15, 2021 at 9:44 | comment | added | shaola | Sorry I edited again | |
| Sep 15, 2021 at 9:43 | comment | added | John | But where do you specify that its only Stef for which you want to extract records. I've edited the post to include what I have but I don't know how to include the if statement in there. | |
| Sep 15, 2021 at 9:41 | history | answered | shaola | CC BY-SA 4.0 |