![]() |
|
|
|
|
|||||||
| Forums | Portal | Register | Forum Rules | FAQ | Contribute | Members List | Arcade | Search | Today's Posts | Mark Forums Read |
| Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts here. |
|
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| compare 2 files.. | amon | Shell Programming and Scripting | 8 | 06-23-2008 07:34 AM |
| compare two files | charandevu | Shell Programming and Scripting | 7 | 03-30-2008 12:20 PM |
| Compare files | kharen11 | UNIX for Advanced & Expert Users | 25 | 03-14-2007 01:35 AM |
| compare files and beyond | MizzGail | UNIX for Dummies Questions & Answers | 2 | 04-25-2003 10:34 AM |
| compare files | ingunix | UNIX for Dummies Questions & Answers | 3 | 05-24-2001 08:44 AM |
|
|
Submit Tools | LinkBack | Thread Tools | Display Modes |
| Forum Sponsor | ||
|
|
|
||||
|
Quote:
it's an "ugly" and "buggy" code (think what happens if your file2 is big I'm not able to write a good code in 2 minutes The first command generate your pattern list with a various "or" ("|"). The second tests all the records (RS="</object>" assumed) in file1 against it. |
|
|||
|
comment
Quote:
|
|
|||
|
Quote:
|
|
||||
|
Quote:
Code:
patt="$(printf "id=\"%s\"|" $(<file2))" Code:
awk '$0 ~ patt{print $0RS}' RS="</object>" patt="${patt%|}" file1
|