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

  • Home
  • SEARCH
  • 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 you come by Zip files with file or directory with some unrecognized characters
Sometimes it would be useful to know whether the compiler requires a pre-compiled header
Sometimes I need to deal with huge PDF files, in such case, I use
I want to create a dynamic worksheet for my students, so every time they
I have a model to keep track of points a student earns. Sometimes they
Sometimes i face the following problem : string txt = con.Request.Params[Par_name].ToString();//the original par value
Sometimes I feel the urge to put some more expressiveness in my git commit
Sometimes when using Visual Studio it displays a prompt with a filename: This file
Sometimes I heard people discussing about the start-up time for Java. It seems this
Sometimes, tomcat restart will cause my application stop immediately so that my consuming data

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.