![]() |
How to compare/diff a range of lines from two text files
i tried using diff --GTYPE-group-format= with <%, but not sure that's the right solution.
Here's what im trying to do. I have two c source files, file1 and file2. file1 has a function in it that's been modified in file2. However, the functions begin at differnt line numbers in eachof the files. Is there a way to specify a range of file numbers on file1 and file2 to compare, using diff or any other combination of utilities? I can always output text from a range of lines from each file to two separate and new files and then compare those, but that's tedious. I could also write up a script to automate this type of solution, but I imagine there's an existing way of doing this. |
I think I just put together a working solution, a combination of other existing, similar solutions:
diff <(grep-w FileA | sed -n '21,51p' file1) <(grep-w FileB | sed -n '120,147p' file2) |
| All times are GMT -5. The time now is 06:52 AM. |