04 2021 档案

摘要:1、 #include <stdio.h> int main(void) { int i, j, a[6][2]; for(i = 0; i < 6; i++) { for(j = 0; j < 2; j++) { printf("a[%d][%d] = ", i, j); scanf("%d", 阅读全文
posted @ 2021-04-30 23:54 小鲨鱼2018 阅读(53) 评论(0) 推荐(0) 编辑
摘要:求4行3列矩阵和3行4列矩阵的乘积。各构成元素的值从键盘输入。 1、 #include <stdio.h> int main(void) { int i, j, k, a[4][3], b[3][4], c[4][4] = {0}; puts("input the elements of 4 row 阅读全文
posted @ 2021-04-30 22:57 小鲨鱼2018 阅读(562) 评论(0) 推荐(1) 编辑
摘要:1、 #include <stdio.h> #define NUMBER 1000 int main(void) { int i, j, num, a[NUMBER], b[11] = {0}; do { printf("num = "); scanf("%d", &num); if(num < 1 阅读全文
posted @ 2021-04-29 21:32 小鲨鱼2018 阅读(70) 评论(0) 推荐(0) 编辑
摘要:1、 #include <stdio.h> #define NUMBER 1000 int main(void) { int i, j, num, a[NUMBER], b[11] = {0}; do { printf("num = "); scanf("%d", &num); if(num < 1 阅读全文
posted @ 2021-04-29 17:36 小鲨鱼2018 阅读(118) 评论(0) 推荐(0) 编辑
摘要:1、 #include <stdio.h> #define NUMBER 1000 int main(void) { int i, num, a[NUMBER]; do { printf("number of element: "); scanf("%d", &num); if(num < 1 | 阅读全文
posted @ 2021-04-29 16:56 小鲨鱼2018 阅读(86) 评论(0) 推荐(0) 编辑
摘要:1、 #include <stdio.h> #define NUMBER 4 int main(void) { int i, a[NUMBER]; printf("the number of elements: %d\n", NUMBER); for(i = 0; i < NUMBER; i++) 阅读全文
posted @ 2021-04-29 16:45 小鲨鱼2018 阅读(114) 评论(0) 推荐(0) 编辑
摘要:在应用对象式宏的数组中对数组的元素进行倒序排列。 1、 #include <stdio.h> #define NUMBER 9 int main(void) { int i, a[NUMBER]; puts("please input the elements."); for(i = 0; i < 阅读全文
posted @ 2021-04-29 16:15 小鲨鱼2018 阅读(92) 评论(0) 推荐(0) 编辑
摘要:将数组a的元素倒序复制到数组b中。 1、 #include <stdio.h> int main(void) { int i, a[7] = {3,2,8,4,2,9,1}, b[7]; for(i = 0; i < 7; i++) { b[i] = a[6 - i]; } for(i = 0; i 阅读全文
posted @ 2021-04-29 15:57 小鲨鱼2018 阅读(902) 评论(0) 推荐(0) 编辑
摘要:c语言中数组元素的个数。 虽然通过对象式宏修改数组元素个数非常的方便,但是每次都需要对程序进行修改,然后重新编译执行。因此,我们可以定义一个比较大的数组,然后从头开始仅使用其中需要的部分。 1、 #include <stdio.h> #define NUMBER 1000 int main(void 阅读全文
posted @ 2021-04-29 12:09 小鲨鱼2018 阅读(1338) 评论(0) 推荐(0) 编辑
摘要:1、反转 永久反转 >>> test1 ['aa', 'bb', 'aa', 'cc', 'aa', 'cc', 'dd', 'xx', 'bb'] >>> test1.reverse() >>> test1 ['bb', 'xx', 'dd', 'cc', 'aa', 'cc', 'aa' 阅读全文
posted @ 2021-04-28 21:35 小鲨鱼2018 阅读(266) 评论(0) 推荐(0) 编辑
摘要:python中返回列表中指定元素的所有索引。 1、基本用法 >>> test1 ['aa', 'bb', 'aa', 'cc', 'aa', 'cc', 'dd', 'xx', 'bb'] >>> test1.index("aa") 0 2、返回所有索引 >>> test1 ['aa', 'bb', 阅读全文
posted @ 2021-04-28 21:22 小鲨鱼2018 阅读(3017) 评论(0) 推荐(0) 编辑
摘要:python中返回列表元素的每一个元素的频数。 1、单个元素频数 >>> test1 ['aa', 'bb', 'aa', 'cc', 'aa', 'cc', 'dd', 'xx', 'bb'] >>> test1.count("aa") 3 2、 >>> test1 ['aa', 'bb', 'a 阅读全文
posted @ 2021-04-28 20:55 小鲨鱼2018 阅读(241) 评论(0) 推荐(0) 编辑
摘要:python中列表元素的去重复 1、方法1 >>> test1 = ["aa","bb","aa","cc","aa","cc","dd","xx","bb"] >>> test1 ['aa', 'bb', 'aa', 'cc', 'aa', 'cc', 'dd', &# 阅读全文
posted @ 2021-04-28 20:35 小鲨鱼2018 阅读(244) 评论(0) 推荐(0) 编辑
摘要:python中列表的连接操作符、重复操作符、成员关系操作符。 1、连接操作符,相当于列表对象extend >>> test1 = ["aa","bb"] >>> test1 ['aa', 'bb'] >>> test2 = ["cc","dd"] >>> test2 ['cc', 'dd'] >>> 阅读全文
posted @ 2021-04-28 20:31 小鲨鱼2018 阅读(456) 评论(0) 推荐(0) 编辑
摘要:python中列表切片。 1、基本用法 >>> test1 [11, 22, 33, 44, 55, 66, 77, 88, 99, 0] >>> test1[2:5] [33, 44, 55] 2、 >>> test1 [11, 22, 33, 44, 55, 66, 77, 88, 99, 0] 阅读全文
posted @ 2021-04-28 20:14 小鲨鱼2018 阅读(224) 评论(0) 推荐(0) 编辑
摘要:python中从列表中删除元素 remove:删除指定元素 pop:删除特定索引位置元素 del:删除变量 1、remove >>> test1 = ["aa","bb","cc","dd","ee","ff","gg"] >>> test1 ['aa', 'bb', 'cc', 'dd', 'ee 阅读全文
posted @ 2021-04-28 19:37 小鲨鱼2018 阅读(673) 评论(0) 推荐(0) 编辑
摘要:1、抽取一个随机数 >>> import random >>> random.randint(1,10) 3 >>> random.randint(1,10) 9 >>> random.randint(1,10) 3 2、从序列(列表、元组、字符串)中随机抽取一个元素 >>> test1 = ["a 阅读全文
posted @ 2021-04-28 19:30 小鲨鱼2018 阅读(1765) 评论(0) 推荐(0) 编辑
摘要:python中向列表中添加元素 append、追加一个元素 extend、扩展多个元素 insert、插入一个元素。 1、append >>> test1 = ["aaa","bbb","ccc"] >>> test1 ['aaa', 'bbb', 'ccc'] >>> test1.append(" 阅读全文
posted @ 2021-04-28 18:01 小鲨鱼2018 阅读(1005) 评论(0) 推荐(0) 编辑
摘要:python中for、while语句计算1-100的和。 1、for语句 1-100的和 >>> sum = 0 >>> for i in range(1,101): sum += i >>> print(sum) 5050 >>> 1-100内偶数的和 >>> sum = 0 >>> for i 阅读全文
posted @ 2021-04-28 15:43 小鲨鱼2018 阅读(4483) 评论(0) 推荐(0) 编辑
摘要:1、原始游戏 (input 内建函数用于接收用户输入) temp = input("please input an integer:") guess = int(temp) if guess == 8: print("you are right!") print("no gift evec thou 阅读全文
posted @ 2021-04-28 15:23 小鲨鱼2018 阅读(1110) 评论(0) 推荐(0) 编辑
摘要:python中原始字符串和长字符串 1、原始字符串 >>> string="c:\now" >>> string 'c:\now' >>> print(string) ## \n被解释为换行符 c: ow >>> 在字符串前添加r,表示原始字符串 >>> string = r"c:\now" >>> 阅读全文
posted @ 2021-04-28 15:18 小鲨鱼2018 阅读(261) 评论(0) 推荐(0) 编辑
摘要:c语言中程序的循环控制 大小值的判断及赋值。 输出长度大于高度的矩形。 1、 #include <stdio.h> int main(void) { int i, j, height, width, min, max; printf("please input the height and widt 阅读全文
posted @ 2021-04-28 10:07 小鲨鱼2018 阅读(294) 评论(0) 推荐(0) 编辑
摘要:1、显示所有的小于输入的整数的所有2的乘方 while语句: #include <stdio.h> int main(void) { int i = 2, j; puts("please input an integer."); printf("j = "); scanf("%d", &j); wh 阅读全文
posted @ 2021-04-28 09:44 小鲨鱼2018 阅读(249) 评论(0) 推荐(0) 编辑
摘要:mean 阅读全文
posted @ 2021-04-27 23:38 小鲨鱼2018 阅读(41) 评论(0) 推荐(0) 编辑
摘要:R语言中自编函数(例题) 1、 mystats <- function(x, parametric = TRUE, print = FALSE){ if (parametric) { center = mean(x); spread = sd(x) }else { center <- median( 阅读全文
posted @ 2021-04-27 17:04 小鲨鱼2018 阅读(950) 评论(0) 推荐(0) 编辑
摘要:R语言中自定义函数以函数的加载调用 1、自定义函数 test1 <- function(x,y){ a = (x + y) print(a) } test2 <- function(x, y){ a = x - y print(a) } test3 <- function(x, y){ a = x 阅读全文
posted @ 2021-04-27 16:34 小鲨鱼2018 阅读(3233) 评论(0) 推荐(0) 编辑
摘要:1、测试break #include <stdio.h> int main(void) { int i, j; puts("please input an integer."); printf("j = "); scanf("%d", &j); for(i = 1; i <= j; i++) { i 阅读全文
posted @ 2021-04-27 14:59 小鲨鱼2018 阅读(693) 评论(0) 推荐(0) 编辑
摘要:1、for语句 for (i in 1:5) { print("hello world!") } 2、for语句 sum = 0 for (i in 1:100){ sum = sum + i } print(sum) 3、for语句 sum = 0 for (i in 1:100) { if (i 阅读全文
posted @ 2021-04-27 12:29 小鲨鱼2018 阅读(729) 评论(0) 推荐(0) 编辑
摘要:R语言中aggregate函数进行数据整合 1、 name <- rep(c("a","b","c"),3) math <- 1:9 eng <- c(3,5,2,2,4,8,7,2,4) chi <- c(3,4,8,5,9,4,7,5,6) test <- data.frame(name, ma 阅读全文
posted @ 2021-04-27 12:11 小鲨鱼2018 阅读(388) 评论(0) 推荐(0) 编辑
摘要:R语言中apply函数(实现对数据框或者矩阵行或者列的计算) 1、 a <- matrix(sample(1:10,12,replace = T), nrow = 4,ncol = 3) a b <- apply(a, 1, sum) ## 1表示按照行计算, 2表示按照列进行计算 b c <- a 阅读全文
posted @ 2021-04-27 11:30 小鲨鱼2018 阅读(163) 评论(0) 推荐(0) 编辑
摘要:1、subset函数(同时实现对行和列的提取) a <- 1:8 b <- letters[1:8] c <- LETTERS[1:8] d <- data.frame(a,b,c) d e <- subset(d,a > 4 & a < 8, select = c(a,b)) e f <- sub 阅读全文
posted @ 2021-04-27 11:21 小鲨鱼2018 阅读(594) 评论(0) 推荐(0) 编辑
摘要:输出向下的金字塔 1、for语句 #include <stdio.h> int main(void) { int i, j, layer; puts("please input the layer"); printf("layer = "); scanf("%d", &layer); for(i = 阅读全文
posted @ 2021-04-27 10:56 小鲨鱼2018 阅读(275) 评论(0) 推荐(0) 编辑
摘要:输出金字塔性状。 1、for语句 #include <stdio.h> int main(void) { int i, j, layer; puts("please input the layer"); printf("layer = "); scanf("%d", &layer); for(i = 阅读全文
posted @ 2021-04-27 10:29 小鲨鱼2018 阅读(585) 评论(0) 推荐(0) 编辑
摘要:输出直角在右上角的等腰直角三角形。 1、for语句 #include <stdio.h> int main(void) { int i, j, len; puts("please input the len."); printf("len = "); scanf("%d", &len); for(i 阅读全文
posted @ 2021-04-27 10:09 小鲨鱼2018 阅读(803) 评论(0) 推荐(0) 编辑
摘要:输出直角在左上方的等腰直角三角形。 1、for语句 #include <stdio.h> int main(void) { int i, j, len; puts("please input the len."); printf("len = "); scanf("%d", &len); for(i 阅读全文
posted @ 2021-04-27 10:00 小鲨鱼2018 阅读(412) 评论(0) 推荐(0) 编辑
摘要:c语言 4-22 显示出一个横向较长的长方形 1、for语句 #include <stdio.h> int main(void) { int i, j, side1, side2; puts("please input the sides."); do { printf("side1 = "); s 阅读全文
posted @ 2021-04-27 09:28 小鲨鱼2018 阅读(290) 评论(0) 推荐(0) 编辑
摘要:c语言4-21 输出指定边长的正方形 1、 #include <stdio.h> int main(void) { int i, j, len; puts("please input an integer."); printf("len = "); scanf("%d", &len); for(i 阅读全文
posted @ 2021-04-27 09:03 小鲨鱼2018 阅读(549) 评论(0) 推荐(0) 编辑
摘要:c语言 4-20 为九九乘法表增加横纵标题。 1、for语句二层循环 #include <stdio.h> int main(void) { int i, j; printf(" |"); for (i = 1; i <= 9; i++) { printf("%3d", i); } putchar( 阅读全文
posted @ 2021-04-27 08:52 小鲨鱼2018 阅读(316) 评论(0) 推荐(0) 编辑
摘要:1、测试数据 测试1 [root@centos7 test2]# cat a.txt 01 02 03 04 05 06 07 08 09 10 2、测试2 [root@centos7 test2]# cat a.txt 01 02 03 04 05 06 07 08 09 10 [root@cen 阅读全文
posted @ 2021-04-26 09:45 小鲨鱼2018 阅读(662) 评论(0) 推荐(0) 编辑
摘要:1、测试数据,测试1 [root@centos7 test2]# seq -f %02g 10 > a.txt [root@centos7 test2]# ls a.txt [root@centos7 test2]# cat a.txt 01 02 03 04 05 06 07 08 09 10 2 阅读全文
posted @ 2021-04-26 09:16 小鲨鱼2018 阅读(891) 评论(0) 推荐(0) 编辑
摘要:R语言中reshape2包 dcast函数数据的重铸 1、测试数据 ID <- c(1, 1, 2, 2) Time <- c(1, 2, 1, 2) X1 <- c(5, 3, 6, 2) X2 <- c(6, 5, 1, 4) mydata <- data.frame(ID, Time, X1, 阅读全文
posted @ 2021-04-25 19:41 小鲨鱼2018 阅读(542) 评论(0) 推荐(0) 编辑
摘要:数据集的融合是将它重构为这样一种形式,每个测量变量独占一行,行中带有要唯一确定这个测量所需的标识符变量。 1、测试数据 ID <- c(1,1,2,2) Time <- c(1,2,1,2) X1 <- c(5,3,6,2) X2 <- c(6,5,1,4) mydata <- data.frame 阅读全文
posted @ 2021-04-25 19:04 小鲨鱼2018 阅读(1030) 评论(0) 推荐(0) 编辑
摘要:R语言中aggregate函数 1、测试数据1 name <- LETTERS[1:8] gender <- c("M","F","F","M","F","M","M","F") age <- c(30,20,40,40,30,20,30,20) height <- c(100,200,300,20 阅读全文
posted @ 2021-04-25 17:37 小鲨鱼2018 阅读(866) 评论(0) 推荐(0) 编辑
摘要:R语言中用户自编函数 1、测试1 mystat <- function(x, parametric = TRUE, print = FALSE){ if(parametric){ center = mean(x); spread = sd(x) } else { center = median(x) 阅读全文
posted @ 2021-04-25 11:06 小鲨鱼2018 阅读(327) 评论(0) 推荐(0) 编辑
摘要:R语言中cat函数。 1、测试1 cat("aa","bb") cat("aa","bb",sep = "_") 2、测试2 a = 100 b = 300 c = "abcd" cat(a,b,c) cat(a,b,c,sep = "_") 3、测试3 a = c("aaa", "bbb", "c 阅读全文
posted @ 2021-04-25 10:33 小鲨鱼2018 阅读(7539) 评论(0) 推荐(0) 编辑
摘要:R语言中的mad函数,绝对中位差 绝对中位差实际求法是用原数据减去中位数后得到的新数据的绝对值的中位数。但绝对中位差常用来估计标准差,估计标准差=1.4826*绝对中位差。R语言中返回的是估计的标准差。 1、测试 a <- c(4, 2, 6, 3, 8) a mad(a) 验证: median(a 阅读全文
posted @ 2021-04-25 09:58 小鲨鱼2018 阅读(4107) 评论(0) 推荐(0) 编辑
摘要:R语言中switch语句。 1、测试1 switch (1, "aaa","bbb","ccc","ddd","eee" ) switch (3, "aaa","bbb","ccc","ddd","eee" ) switch (3, min(1:3), max(1:3), sum(1:3) ) 阅读全文
posted @ 2021-04-25 09:01 小鲨鱼2018 阅读(437) 评论(0) 推荐(0) 编辑
摘要:R语言中while循环 1、测试1 a <- c(3,8,2,7,4,9) i = 1 while (i <= length(a)) { print(a[i]) i = i + 1 } 2、测试2 f <- NA f[1] <- f[2] <- 1 i <- 3 while (i <= 10) { 阅读全文
posted @ 2021-04-24 23:23 小鲨鱼2018 阅读(567) 评论(0) 推荐(0) 编辑
摘要:1、for循环 sum = 0 for (i in 1:100) { sum = sum + i } print(sum) 1-100内偶数的和 sum = 0 for (i in 1:100) { if (i %% 2 == 0) { sum = sum + i } } print(sum) 扩展 阅读全文
posted @ 2021-04-24 22:51 小鲨鱼2018 阅读(9913) 评论(0) 推荐(0) 编辑
摘要:1、测试1 num = 8 if (num %% 2 == 0) { print("even!") } 2、测试2 num = 7 if (num %% 2 == 0) { print("even!") } 3、测试3 num = 7 if (num %% 2 == 0) { print("even 阅读全文
posted @ 2021-04-24 22:18 小鲨鱼2018 阅读(4133) 评论(0) 推荐(0) 编辑
摘要:R语言中利用supply函数提取列表中元素。 1、测试1 a <- c("3_k","4_f","2_t","8_s") a b <- strsplit(a, "_") b class(b) c <- sapply(b, "[",1) c d <- sapply(b, "[",2) d 阅读全文
posted @ 2021-04-24 20:23 小鲨鱼2018 阅读(842) 评论(0) 推荐(0) 编辑
摘要:R语言中scale函数。 scale(x, center = TRUE, scale = TRUE), 为数据对象x按列进行中心化(center = TRUE)或标准化(center=TRUE, scale = TRUE)。 scale函数是将一组数进行处理,默认情况下是将一组数的每个数都减去这组数 阅读全文
posted @ 2021-04-24 17:38 小鲨鱼2018 阅读(2240) 评论(0) 推荐(0) 编辑
摘要:R语言中共apply函数。 R语言中提供了一个apply()函数,可将一个任意函数“应用”到矩阵、数组、数据框的任何维度上。 在矩阵或数据框中,MARGIN=1表示行,MARGIN=2表示列。 1、测试1 a <- matrix(sample(1:10,9),nrow = 3, ncol = 3,b 阅读全文
posted @ 2021-04-24 15:46 小鲨鱼2018 阅读(1199) 评论(0) 推荐(0) 编辑
摘要:1、全部转换为大写 x <- "sfMFdf" x toupper(x) 2、全部转换为小写 x <- "sfMFdf" x tolower(x) 3、首字母大写 x <- "sfMFdf" x library(Hmisc) capitalize(x) ## 只是将首字母修改为大写 library( 阅读全文
posted @ 2021-04-24 12:50 小鲨鱼2018 阅读(5184) 评论(0) 推荐(0) 编辑
摘要:R语言中substr函数,字符串截取函数 1、测试1 x <- "dfserut" x substr(x,1,3) substr(x,2,5) substr(x,2) substring(x,2) 2、测试2 x <- c("sfwsfs","ydsfs","gdsge","mhxsf") x su 阅读全文
posted @ 2021-04-24 12:05 小鲨鱼2018 阅读(5797) 评论(0) 推荐(0) 编辑
摘要:R语言中sub函数和gsub函数 1、 x <- "dwsdffsd" sub("d","M",x) gsub("d","M",x) sub替换第一个匹配的字符,gsub匹配所有的 2、 x <- 1:15 x sub(1,"M",x) gsub(1,"M",x) 处理向量是以每个元素为单位的。 阅读全文
posted @ 2021-04-24 11:54 小鲨鱼2018 阅读(1527) 评论(0) 推荐(0) 编辑
摘要:R语言中求分位数 1、测试1 test <- 1:10 test a <- quantile(test,c(0.25,0.75)) a 阅读全文
posted @ 2021-04-23 23:31 小鲨鱼2018 阅读(2562) 评论(0) 推荐(0) 编辑
摘要:R语言中求值域 1、测试1 test <- c(34,3,9,24,43,87,2) test range(test) ## 求值域 diff(range(test)) ## 求最大值和最小值之差 阅读全文
posted @ 2021-04-23 23:23 小鲨鱼2018 阅读(279) 评论(0) 推荐(0) 编辑
摘要:R语言中diff函数,表示滞后差分 1、测试1 test <- sample(1:10,5) test a <- diff(test) ## diff表示后一个数减去前一个数 a 2、测试2 test <- sample(1:10,5) test a <- diff(test) a b <- dif 阅读全文
posted @ 2021-04-23 23:04 小鲨鱼2018 阅读(8880) 评论(0) 推荐(0) 编辑
摘要:1、测试数据 [root@centos7 test3]# cat b.txt e t s e s g m x w d g i d t e g x g e w 2、打印匹配w的行 [root@centos7 test3]# cat b.txt e t s e s g m x w d g i d t e 阅读全文
posted @ 2021-04-23 18:01 小鲨鱼2018 阅读(1365) 评论(0) 推荐(0) 编辑
摘要:R语言中subset函数同时依据行列进行数据筛选 1、测试数据 manager <- 1:5 date <- c("10/24/08","10/28/08","10/1/08","10/12/08","5/1/09") country <- c("US","US","UK","UK","UK") g 阅读全文
posted @ 2021-04-23 13:00 小鲨鱼2018 阅读(1518) 评论(0) 推荐(0) 编辑
摘要:R语言中根据日期筛选数据 1、测试数据 manager <- 1:5 date <- c("10/24/08","10/28/08","10/1/08","10/12/08","5/1/09") country <- c("US","US","UK","UK","UK") gender <- c(" 阅读全文
posted @ 2021-04-23 12:41 小鲨鱼2018 阅读(4670) 评论(0) 推荐(0) 编辑
摘要:1、测试1 a <- c(3,7,4,1) order(a) ## 返回从小到大排序的索引 rank(a) ## 返回元素从小到大的排名 sort(a) ## 直接对元素从小到大排序 阅读全文
posted @ 2021-04-23 10:58 小鲨鱼2018 阅读(764) 评论(0) 推荐(0) 编辑
摘要:1、判断数据类型 a <- 1:4 class(a) is.numeric(a) is.vector(a) is.character(a) is.logical(a) is.array(a) is.data.frame(a) is.matrix(a) is.factor(a) 2、转换数据类型 a 阅读全文
posted @ 2021-04-23 10:45 小鲨鱼2018 阅读(4348) 评论(0) 推荐(0) 编辑
摘要:1、字符串转换为日期 x <- c("3/5/2004","5/2/2008") y <- as.Date(x,"%m/%d/%Y") y class(y) 2、获取当前日期 Sys.Date() date() 3、日期计算差值 a <- as.Date("2021-03-30") b <- as. 阅读全文
posted @ 2021-04-23 10:35 小鲨鱼2018 阅读(139) 评论(0) 推荐(0) 编辑
摘要:1、查看缺失值 > x <- c(3,1,NA,NA) > x <- c(3,1,NA,NA) > y <- c(3,4,2,7) > z <- c(3,2,5,1) > da <- data.frame(x,y,z) > da x y z 1 3 3 3 2 1 4 2 3 NA 2 5 4 NA 阅读全文
posted @ 2021-04-23 09:19 小鲨鱼2018 阅读(916) 评论(0) 推荐(0) 编辑
摘要:1、测试1 [root@centos7 test2]# i=0 [root@centos7 test2]# max=5 [root@centos7 test2]# while((i<max));do echo $i;((i++));done 0 1 2 3 4 阅读全文
posted @ 2021-04-22 18:47 小鲨鱼2018 阅读(71) 评论(0) 推荐(0) 编辑
摘要:1、测试1 [root@centos7 test2]# for ((i=1; i<=5; i++)); do echo "100"; done 100 100 100 100 100 阅读全文
posted @ 2021-04-22 18:45 小鲨鱼2018 阅读(59) 评论(0) 推荐(0) 编辑
摘要:1、测试1 [root@centos7 test2]# cat test.sh #!/bin/bash read -p "please input an character: " i case $i in [a-z]|[A-Z]) echo "letter!" ;; [0-9]) echo "num 阅读全文
posted @ 2021-04-22 17:07 小鲨鱼2018 阅读(721) 评论(0) 推荐(0) 编辑
摘要:1、隐藏光标 echo -e "\033[?25l" 2、显示光标 echo -e "\033[?25h" 来源:https://blog.csdn.net/weixin_43336281/article/details/99109789 阅读全文
posted @ 2021-04-22 16:19 小鲨鱼2018 阅读(378) 评论(0) 推荐(0) 编辑
摘要:1、测试1 求1-100的和 [root@centos7 test2]# cat test.sh #!/bin/bash sum=0 a=1 while [ $a -le 100 ] do let sum+=$a let a++ done echo "the sum of 1-100 is: $su 阅读全文
posted @ 2021-04-22 15:51 小鲨鱼2018 阅读(1303) 评论(0) 推荐(0) 编辑
摘要:1、for语句 [root@centos7 test2]# cat test.sh #!/bin/bash sum=0 for i in `seq $1` do let sum+=$i done echo "the sum of 1-$1 is: $sum" [root@centos7 test2] 阅读全文
posted @ 2021-04-22 13:05 小鲨鱼2018 阅读(3962) 评论(0) 推荐(0) 编辑
摘要:1、测试1 [root@centos7 test2]# ls a.txt [root@centos7 test2]# if [ -e a.txt ]; then echo "exist";else echo "no nxist"; fi exist [root@centos7 test2]# if 阅读全文
posted @ 2021-04-22 12:35 小鲨鱼2018 阅读(289) 评论(2) 推荐(0) 编辑
摘要:linux shell脚本中流程控制语句 if、for、while、case 1、if语句 [root@centos7 test2]# ls test.sh [root@centos7 test2]# pwd /home/test2 [root@centos7 test2]# cat test.sh 阅读全文
posted @ 2021-04-21 23:16 小鲨鱼2018 阅读(369) 评论(0) 推荐(0) 编辑
摘要:linux系统中条件测试语句分为4类: 1、文件测试语句 2、逻辑测试语句 3、整数值比较语句 4、字符串比较语句 一、文件测试语句 -e :是否存在 -f :是否为文件 -d:是否为目录文件 -r:是否具有读的权限 -w: 是否具有写的权限 -x:是否具有执行的权限 [root@PC3 test] 阅读全文
posted @ 2021-04-21 18:35 小鲨鱼2018 阅读(220) 评论(0) 推荐(0) 编辑
摘要:1、基本shell脚本 #!/bin/bash command 2、参数的变量 $0:脚本名称 $#:参数的数目 $*:参数 $1:第一个参数 $2:第二个参数 $3:第三个参数 $?:上一条命令执行成功输出0,否则其他数字。 [root@PC3 test]# cat a.sh #!/bin/bas 阅读全文
posted @ 2021-04-21 18:10 小鲨鱼2018 阅读(757) 评论(0) 推荐(0) 编辑
摘要:1、read从键盘读入 [root@centos7 test]# echo $a [root@centos7 test]# read a 123456 [root@centos7 test]# echo $a 123456 2、-p 参数 加入提示 [root@centos7 test]# unse 阅读全文
posted @ 2021-04-21 13:58 小鲨鱼2018 阅读(197) 评论(0) 推荐(0) 编辑
摘要:1、测试for cat [root@PC3 test]# cat a.txt 01 02 03 06 07 08 11 12 13 16 17 18 [root@PC3 test]# for i in `cat a.txt`; do echo $i ; done 01 02 03 06 07 08 阅读全文
posted @ 2021-04-21 13:06 小鲨鱼2018 阅读(1423) 评论(0) 推荐(0) 编辑
摘要:1、测试数据 [root@PC3 test]# cat a.txt e i e s d e t q s g e g 2、 [root@PC3 test]# cat a.txt e i e s d e t q s g e g [root@PC3 test]# sed 's/ /\n/g' a.txt 阅读全文
posted @ 2021-04-21 12:29 小鲨鱼2018 阅读(776) 评论(0) 推荐(0) 编辑
摘要:1、过滤是5的倍数的数值 #include <stdio.h> int main(void) { int i = 1, j; puts("please input an integer."); printf("j = "); scanf("%d", &j); for (i; i <= j; i++) 阅读全文
posted @ 2021-04-20 23:06 小鲨鱼2018 阅读(157) 评论(0) 推荐(0) 编辑
摘要:c语言中continue语句;执行continue语句后,循环体的剩余部分就会被跳过。 例子; 1、原始程序。输出矩形。 #include <stdio.h> int main(void) { int i, j, height, width; puts("please input the heigh 阅读全文
posted @ 2021-04-20 22:37 小鲨鱼2018 阅读(1200) 评论(0) 推荐(0) 编辑
摘要:1、原始程序 #include <stdio.h> int main(void) { int i = 1, j; puts("please input an integer."); do { printf("j = "); scanf("%d", &j); if (j <= 0) puts("the 阅读全文
posted @ 2021-04-20 21:42 小鲨鱼2018 阅读(331) 评论(0) 推荐(0) 编辑
摘要:1、while语句 #include <stdio.h> int main(void) { int i = 1, j; puts("please input an integer."); do { printf("j = "); scanf("%d", &j); if (j <= 0) puts(" 阅读全文
posted @ 2021-04-20 20:19 小鲨鱼2018 阅读(955) 评论(0) 推荐(0) 编辑
摘要:1、while语句 #include <stdio.h> int main(void) { int i = 1, j; puts("please input an integer."); do { printf("j = "); scanf("%d", &j); if (j <= 0) puts(" 阅读全文
posted @ 2021-04-20 19:01 小鲨鱼2018 阅读(384) 评论(0) 推荐(0) 编辑
摘要:将输入的正整数进行逆向输出。 1、while语句 #include <stdio.h> int main(void) { int i, j = 0; puts("please input an integer."); do { printf("i = "); scanf("%d", &i); if 阅读全文
posted @ 2021-04-20 15:37 小鲨鱼2018 阅读(698) 评论(0) 推荐(0) 编辑
摘要:1、while语句 #include <stdio.h> int main(void) { int i = 2, j; puts("please input an integer."); do { printf("j = "); scanf("%d", &j); if (j <= 2) puts(" 阅读全文
posted @ 2021-04-20 13:06 小鲨鱼2018 阅读(152) 评论(0) 推荐(0) 编辑
摘要:1、while语句 #include <stdio.h> int main(void) { int i; puts("please input an integer."); do { printf("i = "); scanf("%d", &i); if (i <= 0) puts("the ran 阅读全文
posted @ 2021-04-19 23:28 小鲨鱼2018 阅读(928) 评论(0) 推荐(0) 编辑
摘要:采用的计算公式 (身高 - 100)* 0.9. 1、while语句 #include <stdio.h> int main(void) { int start, end, gap; puts("please input the start, end and gap."); printf("star 阅读全文
posted @ 2021-04-19 19:36 小鲨鱼2018 阅读(610) 评论(0) 推荐(0) 编辑
摘要:1、while语句 #include <stdio.h> int main(void) { int i = 1, j; puts("please input an integer."); do { printf("j = "); scanf("%d", &j); if (j <= 0) puts(" 阅读全文
posted @ 2021-04-19 19:04 小鲨鱼2018 阅读(736) 评论(0) 推荐(0) 编辑
摘要:1、while语句 #include <stdio.h> int main(void) { int i, sum = 0; puts("please input an integer."); do { printf("i = "); scanf("%d", &i); if (i <= 0) puts 阅读全文
posted @ 2021-04-19 18:37 小鲨鱼2018 阅读(1184) 评论(0) 推荐(0) 编辑
摘要:1、while语句 #include <stdio.h> int main(void) { int i, cnt = 0; puts("please input an integer."); do { printf("i = "); scanf("%d", &i); if (i <= 0) puts 阅读全文
posted @ 2021-04-19 17:42 小鲨鱼2018 阅读(509) 评论(0) 推荐(0) 编辑
摘要:1、while语句 #include <stdio.h> int main(void) { int i; puts("please input an integer."); do { printf("i = "); scanf("%d", &i); if (i <= 0) puts("the ran 阅读全文
posted @ 2021-04-19 17:14 小鲨鱼2018 阅读(292) 评论(0) 推荐(0) 编辑
摘要:实质为限制程序循环的次数。 1、while语句 #include <stdio.h> int main(void) { int i; puts("please input an integer."); printf("i = "); scanf("%d", &i); while (i-- > 0) 阅读全文
posted @ 2021-04-19 16:37 小鲨鱼2018 阅读(579) 评论(0) 推荐(0) 编辑
摘要:1、while语句 #include <stdio.h> int main(void) { int i; puts("please input an integer."); printf("i = "); scanf("%d", &i); if (i >= 0) { if (i % 2) { whi 阅读全文
posted @ 2021-04-19 12:52 小鲨鱼2018 阅读(666) 评论(0) 推荐(0) 编辑
摘要:1、原始程序 #include <stdio.h> int main(void) { int i; puts("please input an integer."); printf("i = "); scanf("%d", &i); while (i-- > 0) { putchar('*'); } 阅读全文
posted @ 2021-04-19 12:02 小鲨鱼2018 阅读(141) 评论(0) 推荐(0) 编辑
摘要:1、do语句 #include <stdio.h> int main(void) { int i = 2, j; puts("please input an integer."); printf("j = "); scanf("%d", &j); do { printf("%d ", i); i * 阅读全文
posted @ 2021-04-19 11:45 小鲨鱼2018 阅读(418) 评论(0) 推荐(0) 编辑
摘要:1、do语句 #include <stdio.h> #include <math.h> int main(void) { int i = 1, j; puts("please input an integer."); printf("j = "); scanf("%d", &j); do { if 阅读全文
posted @ 2021-04-19 10:29 小鲨鱼2018 阅读(368) 评论(0) 推荐(0) 编辑
摘要:输出小于输入值的所有正偶数。 1、while语句 #include <stdio.h> int main(void) { int i = 2, j; puts("please input an integer."); printf("j = "); scanf("%d", &j); while ( 阅读全文
posted @ 2021-04-18 23:18 小鲨鱼2018 阅读(899) 评论(0) 推荐(0) 编辑
摘要:1、原始程序 #include <stdio.h> int main(void) { int i; puts("please input an integer."); printf("i = "); scanf("%d", &i); while (i >= 0) { printf("%d ", i- 阅读全文
posted @ 2021-04-18 22:52 小鲨鱼2018 阅读(162) 评论(0) 推荐(0) 编辑
摘要:1、原始程序 #include <stdio.h> int main(void) { int i = 0, j; puts("please input an integer."); printf("j = "); scanf("%d", &j); while (i <= j) { printf("% 阅读全文
posted @ 2021-04-18 22:36 小鲨鱼2018 阅读(168) 评论(0) 推荐(0) 编辑
摘要:1、原始程序, 使以下程序在接收负数时不换行 #include <stdio.h> int main(void) { int i; puts("please input an integer."); printf("i = "); scanf("%d", &i); while (i >= 0) { 阅读全文
posted @ 2021-04-18 21:53 小鲨鱼2018 阅读(340) 评论(0) 推荐(0) 编辑
摘要:1、do语句; #include <stdio.h> int main(void) { int a, b, min, max, sum = 0; puts("please input two integers."); printf("a = "); scanf("%d", &a); printf(" 阅读全文
posted @ 2021-04-18 21:24 小鲨鱼2018 阅读(1773) 评论(0) 推荐(0) 编辑
摘要:c语言中使程序执行任意次数。 (1)、可选的任意次数 do语句 #include <stdio.h> int main(void) { int j; do { int i; puts("please input an integer."); printf("i = "); scanf("%d", & 阅读全文
posted @ 2021-04-18 18:09 小鲨鱼2018 阅读(583) 评论(0) 推荐(0) 编辑
摘要:c语言中程序的循环控制,do语句输入两个整数,计算它们之间的所有整数的和。 1、do语句 #include <stdio.h> int main(void) { int a, b, min, max, sum = 0; puts("please input two integers."); prin 阅读全文
posted @ 2021-04-18 17:46 小鲨鱼2018 阅读(1470) 评论(0) 推荐(0) 编辑
摘要:1、奇数 #include <stdio.h> int main(void) { int i; puts("please input an integer."); printf("i = "); scanf("%d", &i); while(i > 0) { if (i % 2) printf("% 阅读全文
posted @ 2021-04-18 12:49 小鲨鱼2018 阅读(387) 评论(0) 推荐(0) 编辑
摘要:linux系统中sort命令。 1、测试数据 [root@centos7 test2]# cat a.txt google 110 5000 baidu 100 5000 guge 50 3000 sohu 100 4500 2、默认按照第一列排序 [root@centos7 test2]# sor 阅读全文
posted @ 2021-04-17 23:25 小鲨鱼2018 阅读(299) 评论(0) 推荐(0) 编辑
摘要:R语言中rnorm函数。(正态分布) 1、基本用法 norm(n, x, y): 产生n个平均数为x,标准差为y的数。 默认情况下,平均数为0, 标准差为1. > a <- rnorm(10) > a [1] 0.08629733 -0.31750665 1.51152649 -0.60992255 阅读全文
posted @ 2021-04-17 22:57 小鲨鱼2018 阅读(4848) 评论(0) 推荐(0) 编辑
摘要:1、 dat <- data.frame(v1=sample(1:15,15),v2=sample(1:15,15)) dat$cat[dat$v1 <= 8] <- "SMALL" dat$cat[dat$v1 > 8 ] <- "BIG" 2、 dat <- data.frame(v1=samp 阅读全文
posted @ 2021-04-17 20:42 小鲨鱼2018 阅读(4941) 评论(0) 推荐(0) 编辑
摘要:R语言中求数据框每一列的最大值、最小值、平均数、中位数、方差和标准差 1、 d <- data.frame(v1=sample(1:10,6),v2=sample(1:10,6),v3=sample(1:10,6), v4=sample(1:10,6)) rmax <- vector() rmin 阅读全文
posted @ 2021-04-17 18:29 小鲨鱼2018 阅读(15190) 评论(0) 推荐(0) 编辑
摘要:1、测试数据 a <- c(8,4,7,6,2,5) 2、最大值、最小值 > max(a) [1] 8 > min(a) [1] 2 3、平均数、中位数 > mean(a) [1] 5.333333 > median(a) [1] 5.5 4、方差、标准差 > var(a) [1] 4.666667 阅读全文
posted @ 2021-04-17 18:15 小鲨鱼2018 阅读(9650) 评论(0) 推荐(0) 编辑
摘要:当数据的维度超过2时,可以使用数组。 1、创建数组。2行3列2面的数组 dim1 <- c("a1","a2") dim2 <- c("b1","b2","b3") dim3 <- c("c1","c2") a <- array(1:12,c(2,3,2),dimnames = list(dim1, 阅读全文
posted @ 2021-04-17 16:41 小鲨鱼2018 阅读(308) 评论(0) 推荐(0) 编辑
摘要:1、 for (i in 1:10) { print("hello,world!") } 2、 for (i in 1:10) { print(i) } 3、 sum = 0 for (i in seq(1,100,1)) { sum = sum + i } print(sum) 4、求二维数组中的 阅读全文
posted @ 2021-04-17 16:07 小鲨鱼2018 阅读(2276) 评论(0) 推荐(0) 编辑
摘要:1、 > a <- c(2,3,4,2,3,4,2,2,4) > b <- as.data.frame(table(a)) > b a Freq 1 2 4 2 3 2 3 4 3 阅读全文
posted @ 2021-04-17 12:24 小鲨鱼2018 阅读(1193) 评论(0) 推荐(0) 编辑
摘要:1、 > a <- c(1,2,2,2,3,1,1,3) > a [1] 1 2 2 2 3 1 1 3 > unique(a) [1] 1 2 3 > duplicated(a) [1] FALSE FALSE TRUE TRUE FALSE TRUE TRUE TRUE > !duplicate 阅读全文
posted @ 2021-04-17 12:18 小鲨鱼2018 阅读(514) 评论(0) 推荐(0) 编辑
摘要:1、测试数据 > a <- 1:5 > b <- 3:7 > a [1] 1 2 3 4 5 > b [1] 3 4 5 6 7 2、取交集 > a %in% b [1] FALSE FALSE TRUE TRUE TRUE > a[a %in% b] [1] 3 4 5 > intersect(a 阅读全文
posted @ 2021-04-17 12:11 小鲨鱼2018 阅读(651) 评论(0) 推荐(0) 编辑
摘要:1、测试数据 > a <- c(3,2,2,2,2,2,9,1,4) > b <- c(7,8,4,4,4,6,5,2,3) > c <- c(3,5,7,4,3,2,1,8,6) > d <- data.frame(a, b, c) > d a b c 1 3 7 3 2 2 8 5 3 2 4 阅读全文
posted @ 2021-04-17 11:49 小鲨鱼2018 阅读(3160) 评论(0) 推荐(0) 编辑
摘要:1、 opar <- par(no.readonly = T) par(fig=c(0,0.8,0,0.8)) plot(mtcars$wt,mtcars$mpg) par(fig=c(0,0.8,0.60,1),new= T) boxplot(mtcars$wt,axes = F,horizont 阅读全文
posted @ 2021-04-16 19:10 小鲨鱼2018 阅读(737) 评论(0) 推荐(0) 编辑
摘要:1、 attach(mtcars) layout(matrix(c(1,1,2,3), 2, 2, byrow=T)) hist(wt) hist(mpg) hist(disp) detach(mtcars) 2、 attach(mtcars) layout(matrix(c(1,2,3,3),2, 阅读全文
posted @ 2021-04-16 18:11 小鲨鱼2018 阅读(1909) 评论(0) 推荐(0) 编辑
摘要:1、 par(mfrow=c(3,2)) plot(1:10) text(1,5,"aa", cex = 2,col = "red") plot(1:10) text(5,5,"bb",cex = 2, col = "blue") plot(1:10) text(5,5, "cc", cex = 2 阅读全文
posted @ 2021-04-16 17:16 小鲨鱼2018 阅读(1591) 评论(0) 推荐(0) 编辑
摘要:1、 > plot(1:10) > locator(1) ## 此时鼠标点击图形中位置,将返回位置坐标 $x [1] 2.202362 $y [1] 7.89666 > text(locator(1),"xxx",cex = 2,col="red") ## 结合text函数,可以图形中添加文本 > 阅读全文
posted @ 2021-04-16 16:49 小鲨鱼2018 阅读(3030) 评论(0) 推荐(0) 编辑
摘要:1、 opar <- par(no.readonly = T) par(mfrow=c(2,2)) plot(1:10) legend("topleft",inset = 0.04,c(paste0("lab", 1:4)),pch = c(15:18), col = c("red","blue", 阅读全文
posted @ 2021-04-16 16:31 小鲨鱼2018 阅读(4875) 评论(0) 推荐(0) 编辑
摘要:1、 plot(1:10) abline(h=5,col="red",lty=2,lwd = 3) 2、 plot(1:10) abline(h=c(2,4,6),col="red",lwd=3) 3、 plot(1:10) abline(v=c(2,4,8), col = "blue", lwd 阅读全文
posted @ 2021-04-16 15:43 小鲨鱼2018 阅读(1758) 评论(0) 推荐(0) 编辑
摘要:1、 library(Hmisc) opar <- par(no.readonly = T) par(mfrow=c(1,2)) plot(1:10) plot(1:10) minor.tick(nx=2,ny=3,tick.ratio = 0.5) par(opar) 2、 library(Hmi 阅读全文
posted @ 2021-04-16 12:19 小鲨鱼2018 阅读(557) 评论(0) 推荐(0) 编辑
摘要:1、去除外围框线 opar <- par(no.readonly = T) par(mfrow = c(2,1)) plot(1:10) plot(1:10, axes = F) par(opar) 2、去除x轴标线 opar <- par(no.readonly = T) par(mfrow = 阅读全文
posted @ 2021-04-16 11:52 小鲨鱼2018 阅读(5824) 评论(0) 推荐(0) 编辑
摘要:1、 [root@centos7 test]# ls a.txt [root@centos7 test]# cat a.txt i e s m u w e i p q x z u n k e c b v y [root@centos7 test]# sed 's/.$//' a.txt i e s 阅读全文
posted @ 2021-04-16 09:14 小鲨鱼2018 阅读(1848) 评论(0) 推荐(0) 编辑
摘要:1、随机抽样 > a <- 1:10 > sample(a,5) [1] 9 4 5 10 6 > sample(a,5,replace = T) [1] 10 7 5 3 4 > sample(a,5,replace = T) ## 有放回抽样 [1] 5 9 5 1 3 > b <- LETTE 阅读全文
posted @ 2021-04-15 22:24 小鲨鱼2018 阅读(2321) 评论(0) 推荐(0) 编辑
摘要:1、和 [root@centos7 test]# cat a.txt 3 8 9 4 2 4 8 1 9 8 4 2 8 5 3 2 [root@centos7 test]# sed -n '1p' a.txt 3 8 9 4 [root@centos7 test]# sed -n '1p' a.t 阅读全文
posted @ 2021-04-15 22:06 小鲨鱼2018 阅读(1045) 评论(0) 推荐(1) 编辑
摘要:1、最大值 [root@centos7 test]# cat a.txt 4 2 8 6 4 9 2 7 5 3 5 7 [root@centos7 test]# awk 'BEGIN{max = 0}{if($1 > max) max = $1}END{print max}' a.txt 6 [r 阅读全文
posted @ 2021-04-15 21:53 小鲨鱼2018 阅读(5426) 评论(0) 推荐(0) 编辑
摘要:1、交集intersect > x <- 1:4 > y <- 3:7 > x [1] 1 2 3 4 > y [1] 3 4 5 6 7 > intersect(x,y) [1] 3 4 2、并集union > x <- 1:4 > y <- 3:7 > x [1] 1 2 3 4 > y [1] 阅读全文
posted @ 2021-04-15 20:38 小鲨鱼2018 阅读(992) 评论(0) 推荐(0) 编辑
摘要:1、简单用法 > a <- c(5:2,3:7,4+1:4) > a [1] 5 4 3 2 3 4 5 6 7 5 6 7 8 > unique(a) ## 去重复 [1] 5 4 3 2 6 7 8 2、数据框 > a <- rep(1, 5) > b <- c(4,3,2,2,4) > c < 阅读全文
posted @ 2021-04-15 19:09 小鲨鱼2018 阅读(3348) 评论(0) 推荐(0) 编辑
摘要:1、按行排列 [root@centos7 test]# cat a.txt 01 02 03 04 05 06 07 08 09 10 11 12 13 14 15 16 17 18 19 20 [root@centos7 test]# cat a.txt | xargs -n 4 01 02 03 阅读全文
posted @ 2021-04-15 18:37 小鲨鱼2018 阅读(464) 评论(0) 推荐(0) 编辑
摘要:1、 [root@centos7 test]# cat a.txt 01 02 03 04 05 06 07 08 09 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 阅读全文
posted @ 2021-04-15 17:28 小鲨鱼2018 阅读(1282) 评论(0) 推荐(0) 编辑
摘要:1、测试数据 [root@centos7 test]# cat a.txt e d g e s d g w a x d g n d i d 2、 [root@centos7 test]# cat a.txt e d g e s d g w a x d g n d i d [root@centos7 阅读全文
posted @ 2021-04-15 14:36 小鲨鱼2018 阅读(277) 评论(0) 推荐(0) 编辑
摘要:1、测试数据 [root@centos7 test2]# cat a.txt e d g e d w i s d g w e i d a x d g i w e n d i d o e w 2、提取1-3列,1-5列 [root@centos7 test2]# cat a.txt e d g e d 阅读全文
posted @ 2021-04-15 11:57 小鲨鱼2018 阅读(2931) 评论(0) 推荐(0) 编辑
摘要:1、测试数据 [root@centos7 test2]# cat a.txt e d g e s d g w a x d g n d i d 2、将第三列替换为xxx [root@centos7 test2]# cat a.txt e d g e s d g w a x d g n d i d [r 阅读全文
posted @ 2021-04-15 11:03 小鲨鱼2018 阅读(4804) 评论(0) 推荐(0) 编辑
摘要:1、测试数据 [root@centos7 test2]# cat a.txt e d g e s d g w a x d g n d i d [root@centos7 test2]# cat a.txt | sed -n l e d g e$ s d g w$ a x d g$ n d i d$ 阅读全文
posted @ 2021-04-15 10:57 小鲨鱼2018 阅读(2213) 评论(0) 推荐(0) 编辑
摘要:1、测试数据 [root@centos7 test2]# ll -h total 1.4G -rw-r--r--. 1 root root 41M Apr 15 09:47 a.map -rw-r--r--. 1 root root 204M Apr 15 09:47 a.ped -rw-r--r- 阅读全文
posted @ 2021-04-15 10:03 小鲨鱼2018 阅读(1176) 评论(0) 推荐(1) 编辑
摘要:1、测试数据 [root@centos7 test2]# ls a.map a.ped b.map b.ped c.ped result.map [root@centos7 test2]# ll -h total 1.4G -rw-r--r--. 1 root root 41M Apr 15 09: 阅读全文
posted @ 2021-04-15 09:57 小鲨鱼2018 阅读(1360) 评论(0) 推荐(1) 编辑
摘要:1、创建测试数据 [root@centos7 test2]# cat > a.txt i s g z e q d k i p m h y u t e ^C [root@centos7 test2]# ls a.txt [root@centos7 test2]# cat a.txt i s g z e 阅读全文
posted @ 2021-04-15 09:44 小鲨鱼2018 阅读(891) 评论(0) 推荐(0) 编辑
摘要:1、创建测试数据 [root@centos7 test2]# touch a.txt b.txt c.txt; mkdir test01 test02 test03 [root@centos7 test2]# ls a.txt b.txt c.txt test01 test02 test03 2、删 阅读全文
posted @ 2021-04-15 09:23 小鲨鱼2018 阅读(991) 评论(0) 推荐(0) 编辑
摘要:1、创建测试数据 [root@centos7 test2]# touch {1..9}.txt [root@centos7 test2]# ls 1.txt 2.txt 3.txt 4.txt 5.txt 6.txt 7.txt 8.txt 9.txt 2、删除3.txt、7.txt外的其他文件 [ 阅读全文
posted @ 2021-04-15 09:05 小鲨鱼2018 阅读(336) 评论(0) 推荐(0) 编辑
摘要:1、问题 [root@rhelpc1 home]# lsb_release -a bash: lsb_release: command not found... 2、解决方法 [root@rhelpc1 home]# yum install redhat-lsb -y Loaded plugins: 阅读全文
posted @ 2021-04-14 15:33 小鲨鱼2018 阅读(476) 评论(0) 推荐(0) 编辑
摘要:1、首先查看yum仓库 [root@localhost home]# yum repolist all Loaded plugins: langpacks, product-id, subscription-manager This system is not registered to Red H 阅读全文
posted @ 2021-04-14 13:06 小鲨鱼2018 阅读(430) 评论(0) 推荐(0) 编辑
摘要:1、查看当前网卡 [root@localhost Desktop]# ifconfig eno16777728: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500 ether 00:0c:29:af:60:a0 txqueuelen 1000 ( 阅读全文
posted @ 2021-04-14 12:57 小鲨鱼2018 阅读(659) 评论(0) 推荐(0) 编辑
摘要:1、找设置 2、点windows安全中心 3、点应用和浏览器控制 4、点击基于声誉的保护设置 5、关闭阻止可能不需要的应用 6、安装完软件重新开启即可。 阅读全文
posted @ 2021-04-12 11:08 小鲨鱼2018 阅读(37257) 评论(0) 推荐(1) 编辑
摘要:1、找设置 2、点windows安全中心 3、点应用和浏览器控制 4、点击基于声誉的保护设置 5、关闭阻止可能不需要的应用 6、安装完软件重新开启即可。 阅读全文
posted @ 2021-04-12 11:05 小鲨鱼2018 阅读(11392) 评论(0) 推荐(0) 编辑
摘要:1 编辑vim /etc/ssh/sshd_config文件 把PermitRootLogin Prohibit-password 添加#注释掉 新添加:PermitRootLogin yes 更改PermitEmptyPasswords为 no 2 然后重启ssh服务 service ssh re 阅读全文
posted @ 2021-04-12 10:59 小鲨鱼2018 阅读(397) 评论(0) 推荐(0) 编辑
摘要:c语言中数组,一般数组。 1、什么是数组,数组有什么用? 为了方便处理而把类型相同的变量有序地组织起来的一种形式。 类型相同的元素集中起来,在内存上排成一条直线。 2、数组的声明。 元素类型、变量名和元素个数。 如 int a[4]. 3、数组的访问。 下标运算符; 如 a[4]. 4、数组的遍历。 阅读全文
posted @ 2021-04-08 18:29 小鲨鱼2018 阅读(113) 评论(0) 推荐(0) 编辑
摘要:c语言中程序的循环控制,for语句。 1、输出从任一正整数到0的所有数字。 #include <stdio.h> int main(void) { int i; puts("please input an integer."); printf("i = "); scanf("%d", &i); fo 阅读全文
posted @ 2021-04-07 18:45 小鲨鱼2018 阅读(600) 评论(0) 推荐(0) 编辑
摘要:c语言中程序的循环控制,while语句。 1、输出从任一正整数到0的所有数字 #include <stdio.h> int main(void) { int i; puts("please input an integer."); printf("i = "); scanf("%d", &i); w 阅读全文
posted @ 2021-04-07 18:05 小鲨鱼2018 阅读(685) 评论(0) 推荐(0) 编辑
摘要:c语言中程序的循环控制,do语句。 1、do语句用户输入决定执行判断奇偶数程序的次数 #include <stdio.h> int main(void) { int j; do { int i; puts("please input an integer."); printf("i = "); sc 阅读全文
posted @ 2021-04-07 16:40 小鲨鱼2018 阅读(474) 评论(0) 推荐(0) 编辑
摘要:c语言中的二重循环。 1、输出九九乘法表 #include <stdio.h> int main(void) { int i, j; for (i = 1; i <= 9; i++) { for (j = 1; j <= 9; j++) { printf("%4d", i * j); } putch 阅读全文
posted @ 2021-04-06 22:07 小鲨鱼2018 阅读(1594) 评论(0) 推荐(0) 编辑
摘要:1、c语言中分支结构程序 switch语句的经典用法。 #include <stdio.h> int main(void) { int i; puts("please input an integer."); printf("i = "); scanf("%d", &i); switch(i % 3 阅读全文
posted @ 2021-04-06 21:07 小鲨鱼2018 阅读(810) 评论(0) 推荐(0) 编辑

点击右上角即可分享
微信分享提示