From 7b37b5bb72fe69da369a070ffb1a5c8cc672cbf6 Mon Sep 17 00:00:00 2001
From: Yechi Ma <2662511702@qq.com>
Date: Sun, 11 Sep 2022 15:21:26 +0800
Subject: [PATCH 1/4] mychomework

---
 lab1/10215501408.c   | 59 ++++++++++++++++++++++++++++++++++++++++++++++++++++
 lab1/10215501408.txt |  2 ++
 2 files changed, 61 insertions(+)
 create mode 100644 lab1/10215501408.c
 create mode 100644 lab1/10215501408.txt

diff --git a/lab1/10215501408.c b/lab1/10215501408.c
new file mode 100644
index 0000000..244286f
--- /dev/null
+++ b/lab1/10215501408.c
@@ -0,0 +1,59 @@
+#include "stdio.h"
+#include "stdlib.h"
+#include "time.h"
+#include "math.h"
+#include "string.h"
+
+/**
+ * @brief generate a file consists of 50000 lines of words, 
+ *        half line has a substring "computer", and is repeated.
+ *        the clone one is stripped of "computer".
+ *        
+ *        0 ~ 9 : 48 ~ 57
+ *        a ~ z : 97 ~ 122
+ * 
+ */
+
+
+void file_create(const char *_addr)
+{
+    FILE *file = fopen(_addr, "w");
+    size_t line = 250000u;
+    srand(time(NULL));
+
+    // char *str = NULL;
+    for (size_t i = 0; i < line; i++) {
+        // str = (char *)malloc(abs(rand())%20 * sizeof(char));
+        char str[abs(rand())%100+1];
+        for (size_t j = 0; j < strlen(str); j++) {
+            if (abs(rand()) % 2 == 0) 
+                str[j] = abs(rand())%10 + 48;
+            else
+                str[j] = abs(rand())%26 + 97;
+        }
+        strcat(str, "computer\n");
+        fputs(str, file);
+        fputs(str, file);
+        // free(str);
+    }   
+
+    fclose(file);
+}
+
+void file_show() 
+{
+    FILE *file = fopen("words.txt", "r");
+    int ch;
+
+    while ((ch = fgetc(file)) != '\n') {
+        printf("%c", ch);
+    }
+
+    fclose(file);
+}
+
+int main()
+{
+    file_create("words.txt");
+    return 0;
+}
\ No newline at end of file
diff --git a/lab1/10215501408.txt b/lab1/10215501408.txt
new file mode 100644
index 0000000..ee304c4
--- /dev/null
+++ b/lab1/10215501408.txt
@@ -0,0 +1,2 @@
+this is a file with the 10215501408.c
+

From 40de73b22642ca9744aae0034d42acd3dc8f6fdf Mon Sep 17 00:00:00 2001
From: Yechi Ma <2662511702@qq.com>
Date: Sun, 11 Sep 2022 15:51:15 +0800
Subject: [PATCH 2/4] =?UTF-8?q?=E2=80=9Cmyc=E2=80=9D?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

---
 lab1/myc.txt | 2 ++
 1 file changed, 2 insertions(+)
 create mode 100644 lab1/myc.txt

diff --git a/lab1/myc.txt b/lab1/myc.txt
new file mode 100644
index 0000000..e600d81
--- /dev/null
+++ b/lab1/myc.txt
@@ -0,0 +1,2 @@
+myc
+

From 2961d4b9f6e1f80ad78b2330859d4ccf5c02e238 Mon Sep 17 00:00:00 2001
From: Yechi Ma <2662511702@qq.com>
Date: Mon, 12 Sep 2022 19:47:53 +0800
Subject: [PATCH 3/4] garbage deleted

---
 lab1/10215501408.txt | 2 --
 lab1/myc.txt         | 2 --
 2 files changed, 4 deletions(-)
 delete mode 100644 lab1/10215501408.txt
 delete mode 100644 lab1/myc.txt

diff --git a/lab1/10215501408.txt b/lab1/10215501408.txt
deleted file mode 100644
index ee304c4..0000000
--- a/lab1/10215501408.txt
+++ /dev/null
@@ -1,2 +0,0 @@
-this is a file with the 10215501408.c
-
diff --git a/lab1/myc.txt b/lab1/myc.txt
deleted file mode 100644
index e600d81..0000000
--- a/lab1/myc.txt
+++ /dev/null
@@ -1,2 +0,0 @@
-myc
-

From 02cc101cb8c4952a124eb0a468bc34c7b4e7d829 Mon Sep 17 00:00:00 2001
From: Yechi Ma <2662511702@qq.com>
Date: Mon, 12 Sep 2022 20:08:12 +0800
Subject: [PATCH 4/4] 10215501408new upload

---
 lab1/10215501408.c   | 59 -----------------------------------
 lab1/10215501408.txt | 87 ++++++++++++++++++++++++++++++++++++++++++++++++++++
 2 files changed, 87 insertions(+), 59 deletions(-)
 delete mode 100644 lab1/10215501408.c
 create mode 100644 lab1/10215501408.txt

diff --git a/lab1/10215501408.c b/lab1/10215501408.c
deleted file mode 100644
index 244286f..0000000
--- a/lab1/10215501408.c
+++ /dev/null
@@ -1,59 +0,0 @@
-#include "stdio.h"
-#include "stdlib.h"
-#include "time.h"
-#include "math.h"
-#include "string.h"
-
-/**
- * @brief generate a file consists of 50000 lines of words, 
- *        half line has a substring "computer", and is repeated.
- *        the clone one is stripped of "computer".
- *        
- *        0 ~ 9 : 48 ~ 57
- *        a ~ z : 97 ~ 122
- * 
- */
-
-
-void file_create(const char *_addr)
-{
-    FILE *file = fopen(_addr, "w");
-    size_t line = 250000u;
-    srand(time(NULL));
-
-    // char *str = NULL;
-    for (size_t i = 0; i < line; i++) {
-        // str = (char *)malloc(abs(rand())%20 * sizeof(char));
-        char str[abs(rand())%100+1];
-        for (size_t j = 0; j < strlen(str); j++) {
-            if (abs(rand()) % 2 == 0) 
-                str[j] = abs(rand())%10 + 48;
-            else
-                str[j] = abs(rand())%26 + 97;
-        }
-        strcat(str, "computer\n");
-        fputs(str, file);
-        fputs(str, file);
-        // free(str);
-    }   
-
-    fclose(file);
-}
-
-void file_show() 
-{
-    FILE *file = fopen("words.txt", "r");
-    int ch;
-
-    while ((ch = fgetc(file)) != '\n') {
-        printf("%c", ch);
-    }
-
-    fclose(file);
-}
-
-int main()
-{
-    file_create("words.txt");
-    return 0;
-}
\ No newline at end of file
diff --git a/lab1/10215501408.txt b/lab1/10215501408.txt
new file mode 100644
index 0000000..44950e5
--- /dev/null
+++ b/lab1/10215501408.txt
@@ -0,0 +1,87 @@
+#include "stdio.h"
+#include "stdlib.h"
+#include "time.h"
+#include "math.h"
+#include "string.h"
+
+/**
+ * @brief generate a file consists of 50000 lines of words, 
+ *        half line has a substring "computer", and is repeated.
+ *        the clone one is stripped of "computer".
+ *        
+ *        0 ~ 9 : 48 ~ 57
+ *        a ~ z : 97 ~ 122
+ * 
+ */
+
+
+void file_create(const char *_addr)
+{
+    FILE *file = fopen(_addr, "w");
+    size_t line = 250000u;
+    srand(time(NULL));
+
+    // char *str = NULL;
+    for (size_t i = 0; i < line; i++) {
+        // str = (char *)malloc(abs(rand())%20 * sizeof(char));
+        char str[abs(rand())%100+1];
+        for (size_t j = 0; j < strlen(str); j++) {
+            if (abs(rand()) % 2 == 0) 
+                str[j] = abs(rand())%10 + 48;
+            else
+                str[j] = abs(rand())%26 + 97;
+        }
+        strcat(str, "computer\n");
+        fputs(str, file);
+        fputs(str, file);
+        // free(str);
+    }   
+
+    fclose(file);
+}
+
+void file_show() 
+{
+    FILE *file = fopen("words.txt", "r");
+    int ch;
+
+    while ((ch = fgetc(file)) != '\n') {
+        printf("%c", ch);
+    }
+
+    fclose(file);
+}
+
+int main()
+{
+    file_create("words.txt");
+    return 0;
+}
+
+
+
+//shell code
+sort words.txt > opt1.txt
+uniq opt1.txt > uniq1.txt
+
+sort -n words.txt > opt2.txt
+uniq opt2.txt > uniq.txt
+
+cat uniq1.txt > override.txt
+cat uniq.txt > override.txt
+
+cat uniq1.txt >> cct.txt
+cat uniq.txt >> cct.txt
+
+grep -o "computer" words.txt > computer.txt
+
+grep -c "computer" words.txt
+
+
+git add 10215501408.txt
+
+git commit -m “myc”
+
+git push -u origin master
+
+