Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6940283
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T12:43:57+00:00 2026-05-27T12:43:57+00:00

Sometimes my students try to submit identical files for their homework. If they did

  • 0

Sometimes my students try to submit identical files for their homework. If they did their homework themselves, it would be impossible for any two files to be the exactly the same.

I put the homework in folders arranged like this: /section/id/

In this way, each section of the course has its own folder, each student has their own folder, and all of the files are within that last level. The student files come in a variety of formats.

  • How can I check if there are any exactly identical files (ignoring file names) within any sub-folder?
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-27T12:43:57+00:00Added an answer on May 27, 2026 at 12:43 pm

    This can help you identify exact same files from your students using the following for loop and awk one-liner:

    Step: 1 – for i in path/to/files; do cksum "$i"; done > cksum.txt
    Step: 2 – awk 'NR==FNR && a[$1]++ { b[$1]; next } $1 in b' cksum.txt cksum.txt

    Test:

    Some sample files in which student 2 has used identical file as student 1

    [jaypal:~/Temp/homework] ls -lrt
    total 32
    -rw-r--r--  1 jaypalsingh  staff  10 17 Dec 17:58 student1
    -rw-r--r--  1 jaypalsingh  staff  10 17 Dec 17:58 student2
    -rw-r--r--  1 jaypalsingh  staff  10 17 Dec 17:58 student3
    -rw-r--r--  1 jaypalsingh  staff  10 17 Dec 17:58 student4
    [jaypal:~/Temp/homework] cat student1 
    homework1
    [jaypal:~/Temp/homework] cat student2 
    homework1
    [jaypal:~/Temp/homework] cat student3 
    homework3
    [jaypal:~/Temp/homework] cat student4 
    homework4
    

    Step 1:

    Create a cksum.txt file using the cksum utility

    [jaypal:~/Temp/homework] for i in *; do cksum "$i"; done > cksum.txt
    [jaypal:~/Temp/homework] cat cksum.txt 
    4294967295 0 cksum.txt
    1271506813 10 student1
    1271506813 10 student2
    1215889011 10 student3
    1299429862 10 student4
    

    Step 2:

    Using awk one-liner identify all files that are same

    [jaypal:~/Temp/homework] awk 'NR==FNR && a[$1]++ { b[$1]; next } $1 in b' cksum.txt cksum.txt 
    1271506813 10 student1
    1271506813 10 student2 
    

    Test 2:

    [jaypal:~/Temp/homework] for i in stu*; do cksum "$i"; done > cksum.txt
    [jaypal:~/Temp/homework] awk 'NR==FNR && a[$1]++ { b[$1]; next } $1 in b' cksum.txt cksum.txt 
    1271506813 10 student1
    1271506813 10 student2
    1271506813 10 student5
    [jaypal:~/Temp/homework] cat student5
    homework1
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Sometimes when I'm editing page or control the .designer files stop being updated with
Sometimes I need to quickly extract some arbitrary data from XML files to put
We are two students who want to use one-class svm for dectection of summary
Sometimes I've seen a solution that includes up to three .csproj files for each
Sometimes IE6 will render the text of a <ul> list the same color as
Sometimes I have to work on code that moves the computer clock forward. In
Sometimes a labeled break or continue can make code a lot more readable. OUTERLOOP:
Sometimes my Oracle database on Windows gets hosed. How do I do a manual
Sometimes, in PL SQL you want to add a parameter to a Package, Function
Sometimes I get Oracle connection problems because I can't figure out which tnsnames.ora file

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.