Closed. This question is off-topic。它当前不接受答案。
                            
                        
                    
                
                            
                                
                
                        
                            
                        
                    
                        
                            想改善这个问题吗? Update the question,所以它是on-topic,用于堆栈溢出。
                        
                        4年前关闭。
                                                                                            
                
        
我知道可以找到要使用的文件之间的差异

diff *file1 file2*


但是说您只想知道包含特定单词的行上的两个文件之间的区别,例如说“ linux”一词。您将如何为此编写命令?会是这样吗?

diff [linux] *file1 file2*


还是在此命令中甚至都使用diff?

最佳答案

使用以下命令查找两个文件之间的差异,并过滤字符串“ linux” diff

diff file1 file2 | grep 'linux' -B1 -A2

08-16 06:57