ICode9

精准搜索请尝试: 精确搜索
  • linux 中 生成文件的sha1码2022-09-11 17:32:11

      001、 root@PC1:/home/test3# ls root@PC1:/home/test3# seq 1000 > a.txt ## 生成一个测试文件 root@PC1:/home/test3# ls a.txt root@PC1:/home/test3# sha1sum a.txt ## 使用sha1sum命令生成sha1码 234e7e9c9c8490946d3e8c2a01bff41e9acce2

  • const char* , char const* 和char * const之间有区别吗?2022-08-14 13:02:09

     最近在看C语言代码时碰到了这个问题,结合查找的资料对这C的知识点做了一下小结。写了一份测试它们的代码。test1函数穿了一个char* const的指针,如果对它增加,会报错,它是只读的。但是可以对指针所指位置的内容进行更改。test2函数测试的是const char类型的参数,test3函数测试的是ch

  • linux系统中如何将每行特定数目字符后的字符替换为指定字符2022-07-22 23:35:49

      001、 root@PC1:/home/test3# ls a.txt root@PC1:/home/test3# cat a.txt e r e y e u e e e g e 3 h r 1 3 e g e y e e s e e e e e root@PC1:/home/test3# cp a.txt a.txt_bak root@PC1:/home/test3# max=$(awk -F "e" '{print NF - 1}' a.txt | sor

  • linux 中统计每一行特定字符出现的次数2022-07-22 23:00:18

      001、 root@PC1:/home/test3# ls a.txt root@PC1:/home/test3# cat a.txt ## 测试数据, 统计每一行出现的k的次数 j k u k r k s k j u e a f d e u i w j j k k e f root@PC1:/home/test3# awk -F "k" '{print NF - 1}' a.txt ## awk实现 3 1 0 2   002、awk循环实现

  • zabbix 监控端口2022-07-22 16:10:19

    通过 监控端口 来确定应用程序是否在运行 1、在~/zabbix_agentd 目录下创建文件 #vim  userparameter_nginx_80.conf(只要以.conf结尾就可以) UserParameter=键值,命令(或者.sh脚本) [root@test3 zabbix_agentd]# cat userparameter_nginx_80.conf UserParameter=nginx_80,ss -lntup

  • linux 中awk命令实现字符串的精确匹配2022-07-08 22:01:58

      001、 root@DESKTOP-1N42TVH:/home/test3# ls test.txt root@DESKTOP-1N42TVH:/home/test3# cat test.txt ## 测试数据 AKCR02000001 df AKCR02000001 df AKCR02000001 er AKCR02000001.1 dg AKCR02000001.1 der AKCR02000001.1 fg AKCR02000001.2 ee AKCR0200

  • linux 中利用变量作为行号删除指定的行2022-06-20 11:36:06

      1、 root@PC1:/home/test3# ls a.txt root@PC1:/home/test3# cat a.txt 1 e d 2 a g 3 w e 4 d g 5 g j 6 e j 7 l m 8 i n root@PC1:/home/test3# a=3 ## 行号 3 root@PC1:/home/test3# b=6 ## 行号 6 root@PC1:/ho

  • 迭代器、生成器、推导式2022-06-16 19:37:19

    #内部含有__iter__方法的都是可迭代对象 for i in '123': print(i) print(dir('123'))#输出对象所有内部方法 print('__iter__' in dir(str))#True print('__iter__' in dir(dict))#True print('__iter__' in dir(list))#True print('__

  • python 中实现文本中字符串的替换2022-06-04 20:35:03

      1、将文本中的所有d替换为QQ [root@PC1 test3]# ls a.txt test.py [root@PC1 test3]# cat a.txt erg iuy dfg fdf er4 435 dft 34f cgd err [root@PC1 test3]# cat test.py #!/usr/bin/python in_file = open("a.txt", "r") out_file = open("result.txt&q

  • python中如何删除文本中指定的列2022-06-04 19:31:13

      1、删除第一列 [root@PC1 test3]# ls a.txt test.py [root@PC1 test3]# 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 40 [root@PC1 test3]# cat test.py #!/usr/bin/python in_file

  • linux 中awk命令实现数据以指定小数位数输出2022-06-02 18:32:34

      1、 [root@PC1 test3]# ls a.txt [root@PC1 test3]# cat a.txt ## 测试数据 8.34565 3.23445 7.32423 0 8.343532523 5.34355 3.355623253 0 0 [root@PC1 test3]# awk '{for(i = 1; i <= NF; i++) printf("%.3f\t", $i); printf("\n")}'

  • python 操作json数据2022-06-01 18:31:28

    简介 JSON(JavaScript Object Notation, JS对象简谱)是一种轻量级的数据交换格式,通常是以键值对的方式呈现,其简洁和清晰的层次结构使得JSON成为理想的数据交换语言,而在Python中处理JSON格式的模块有json和pickle两个。 json模块和pickle都提供了四个方法:dumps, dump, loads, load

  • js同步执行两个函数2022-05-31 17:35:32

    先执行test1(),再执行test2: function test1() { return new Promise(resolve => { setTimeout(() => resolve("test1"), 2000); }); } function test2() { console.log("test2"); } async function test3() { const result =

  • linux 中%.*、%%.*的意义2022-04-29 23:03:48

      1、举例%.*的作用 root@DESKTOP-1N42TVH:/home/test3# a="aa.bb.cc.dd" root@DESKTOP-1N42TVH:/home/test3# echo ${a} aa.bb.cc.dd root@DESKTOP-1N42TVH:/home/test3# echo ${a%.*} ## %.*的作用是删除变量最后一个.及其后的内容 aa.bb.cc   root@DESKTOP-1N42TVH:/ho

  • eleastcsearch01-操作mapping2022-04-28 08:35:41

    # ElasticSearch version "number": "7.14.1" # 获取健康值 GET _cat/health?v # 获取所有的信息 GET _cat/indices?v # mappings信息======================================= # 创建test3索引 # mapping number_of_shards分片数 # number_of_replicas版本数 PUT /test3 {

  • linux中如何统计文本字符的总个数2022-04-15 08:31:14

      1、测试数据 [root@centos7 test3]# ls test.txt [root@centos7 test3]# cat test.txt deet dggh df   2、awk实现 [root@centos7 test3]# ls test.txt [root@centos7 test3]# cat test.txt deet dggh df [root@centos7 test3]# awk '{print length}' test.txt 4 4 2 [

  • linux 中实现每两列数据合并为一列数据2022-04-04 02:34:52

      1、测试数据 root@DESKTOP-1N42TVH:/home/test3# ls a.txt root@DESKTOP-1N42TVH:/home/test3# cat a.txt e t d u e i a d g g z j c b d e w l z c b h j h   2、形式1 root@DESKTOP-1N42TVH:/home/test3# cat a.txt e t d u e i a d g g z j c b d e w l z c b h j h ro

  • 多组一列数据的处理2022-04-04 01:01:06

      1、 root@DESKTOP-1N42TVH:/home/test3# ls a.txt root@DESKTOP-1N42TVH:/home/test3# cat a.txt chr168 0.5 0.66 0.77 0.3 chr254 0.6 0.3 0.89 chr678 0.658 0.5 chr344 0.53 0.596 0.65 0.68 root@DESKTOP-1N42TVH:/home/test3# awk -v RS='chr' 'NR!=1{

  • linux中sed命令匹配特定字符之间的数据2022-04-04 00:08:33

      1、测试数据 root@DESKTOP-1N42TVH:/home/test3# ls a.txt root@DESKTOP-1N42TVH:/home/test3# cat a.txt ## 测试数据 01 02 AAA 03 04 05 BBB 06 07 08 CCC 09 10   2、匹配AAA到BBB之间的数据 root@DESKTOP-1N42TVH:/home/test3# cat a.txt 01 02 AAA 03 04 05 BBB 06

  • linux中 $RANDOM取随机数2022-04-02 12:34:50

     $RANDOM 是linux中的内置变量,可以随机生成 0~32767之间的整数数字。 1、取0~9的随机数 [root@centos7pc1 test3]# ls [root@centos7pc1 test3]# expr $RANDOM % 10 7 [root@centos7pc1 test3]# expr $RANDOM % 10 2 [root@centos7pc1 test3]# expr $RANDOM % 10 0 [root@centos

  • RHCSA/Linux第二天作业2022-03-21 13:33:58

    1.使用timedatectl查看时间状态   列出所有已知时区   修改时区为列出时区的某一个 2.使用wget命令在https://www.pearvideo.com/这个网站下载任意一个视频 3.Linux中的文件类型以及符号的表示 4.创建目录test,并使用一条命令在test下创建 test1/test2/test3   a.输出test3的

  • While控制器2022-03-20 21:35:42

    Condition (function or variable) :条件(函数或变量)。条件为 Flase 的时候,才会跳出 While 循环,否则一直执行 While 控制器下的样例。         1、不填(空):当 While 控制器下最后一个样例执行失败后 跳出循环 test1、test2、test3,都能运行成功,会一直运行下去,陷入死循环    te

  • 三大数据库 sequence 之华山论剑 (上篇)2022-03-02 11:02:28

    前言 本文将基于以下三种关系型数据库,对 sequence (序列) 展开讨论。 Oracle - 应用最广泛的商用关系型数据库 PostgreSQL - 功能最强大的开源关系型数据库 MySQL - 应用最广泛的开源关系型数据库 sequence 适用场景 主键 用于整型主键数据的生成,一般一个 sequence 仅用于一张表的

  • Git基本操作命令及报错解决方案(二)2022-01-16 13:31:17

    一、基础操作命令 1、创建目录:mkdir 文件名 2、进入指定目录:cd 目录名 3、切换至上一级目录:cd .. 4、创建工作空间:git init 5、创建文件:vi 文件名,esc+i进入编辑模式,esc+ZZ退出编辑模式 6、提交至暂存区:git add * 7、提交版本:git commit -m "版本说明" 8、修改文件名称:mv 旧文件

  • python之Spyder绘图2021-12-30 15:06:50

    import numpy as np     #导入科学计算库 import matplotlib.pyplot as plt a=np.arange(10) plt.plot(a/a/a,a*2,'ro-',label='a') plt.plot(a^2,a*2.5,'gx--',label='b') plt.plot(a,a*1.5,'y*-',label='c') plt.plot

专注分享技术,共同学习,共同进步。侵权联系[81616952@qq.com]

Copyright (C)ICode9.com, All Rights Reserved.

ICode9版权所有