Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR SHELL

bash check diff starting at specific line

# Basic syntax:
diff <(head -n <file_1_last_row> <file_1> | tail -n <file_1_rows_b4_last>) <(head -n <file_2_last_row> file2 | tail -n <file_2_rows_b4_last>)
# Where:
#	- head and tail are used to select the rows of file_1 and file_2 that
#		are passed to the diff command (using <() )

# Example usage:
# To compare the 80th to 100th row of file_1 to to 100th to 120 row of file_2:
diff <(head -n 100 file_1 | tail -n 20) <(head -n 120 file_2 | tail -n 20)
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #bash #check #diff #starting #specific #line
ADD COMMENT
Topic
Name
7+6 =