首页 > TAG信息列表 > centos79

在Linux命令行提示符PS1中优雅地显示日期和时间

用"\d"的时候显示的时间是依据系统语言而变化的,文字描述的时间,“二”,“Tue”,"火"等 [root@CentOS79 ~]# export PS1='[\u@\h \d \W]\$ ' [root@CentOS79 Tue Nov 23 ~]# export LANG=zh_CN.UTF-8 [root@CentOS79 二 11月 23 ~]# export LANG=ja_JP.UTF-8 [root@CentOS79 火

linux系统shell实现统计 plink文件基因频率

  1、 [root@centos79 test]# cat test.sh #!/bin/bash #step1 check consistence of columns temp1=`head -n 1 $1 | awk '{print NF}'` for i in $(seq `sed -n "$=" $1`) do temp2=$(sed -n "$i"p $1 | awk '{print NF}') if [ $

linux系统shell实现统计 plink文件基因频率

  1、 [root@centos79 test]# cat test.sh #!/bin/bash #step1 check consistence of columns temp1=`head -n 1 $1 | awk '{print NF}'` for i in $(seq `sed -n "$=" $1`) do temp2=$(sed -n "$i"p $1 | awk '{print NF}') if [ $

c语言实现复制文件

    1、 [root@centos79 test]# cat test.c #include <stdio.h> #include <stdlib.h> #include <string.h> int main(int argc, char * argv[]) { char ch; FILE * in, * out; char name[30]; if(argc < 2) {

linux系统中grep -f选项

1、测试数据 [root@centos79 test]# ls a.txt b.txt [root@centos79 test]# cat a.txt e k [root@centos79 test]# cat b.txt e r t d f 3 s g k i e x d f g   2、以a.txt中每一行为关键字,查找b.txt中匹配的行 [root@centos79 test]# cat a.txt e k [root@centos79 test]# c

linux 系统中如何统计文件列数

1、测试数据 [root@centos79 test]# cat a.txt e r w i s g n c w d h x   2、awk [root@centos79 test]# cat a.txt e r w i s g n c w d h x [root@centos79 test]# awk '{print NF}' a.txt 4 4 4 [root@centos79 test]# awk 'END{print NF}' a.txt 4   3

linux系统中实现文本转置。

1、测试数据 [root@centos79 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 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 7

linux系统中批量提取指定行的数据

  1、测试数据 [root@centos79 test]# cat a.txt 01 3 4 02 f s 03 t 3 04 s d 05 g i 06 y e 07 a w 08 d g 09 e w 10 n u 11 7 8 12 3 s 13 a d 14 g e 15 w a 16 z v 17 n m 18 k p   2、提取 3,5,7,8,9,15,17行 使用sed [root@centos79 test]# ls a.txt lines [root@ce

linux系统中nl命令

linux系统中nl命令 1、测试数据 [root@centos79 test3]# cat a.txt e 3 8 i d f a e 8 3 s g g j 2 z t y c g s g s a   2、nl命令 [root@centos79 test3]# cat a.txt e 3 8 i d f a e 8 3 s g g j 2 z t y c g s g s a [root@centos79 test3]# nl a.txt 1 e 3 8 i

linux 系统中pgrep命令

linux系统中pgrep用于查找进程 1、查找与命令相关的进程 [root@centos79 test]# pgrep sort [root@centos79 test]#   启动一个sort命令测试: [root@centos79 test]# seq -f test%03g 100000000| sort | uniq -c [root@centos79 test]# pgrep sort ## 另外一个终端 18521 [roo

linux系统中diff命令

1、测试文件 [root@centos79 test]# cat a.txt 3 5 6 s f s d g d e w f g e k [root@centos79 test]# cat b.txt 3 5 6 s f s d g d e w f g e k   2、直接使用diff [root@centos79 test]# cat a.txt 3 5 6 s f s d g d e w f g e k [root@centos79 test]# cat b.txt 3 5 6 s

linux系统中如何将文件的某一类替换为其他文件的指定列

1、测试数据 [root@centos79 test]# cat a.txt e t q t x g a w i k h e [root@centos79 test]# cat b.txt 4 5 6 2 d 2 s g y   2、将b.txt中的第2列用a.txt中的第3列进行替换 [root@centos79 test]# cat a.txt e t q t x g a w i k h e [root@centos79 test]# cat b.txt 4 5

linux系统中删除文件的第一列

1、测试数据 [root@centos79 test]# cat a.txt e t q t x g a w i k h e   2、cut删除 [root@centos79 test]# cat a.txt e t q t x g a w i k h e [root@centos79 test]# cut -d " " -f 2- a.txt t q t g a w k h e   3、sed删除 [root@centos79 test]# cat a.txt e t q

linux系统中查看逻辑cpu个数、物理cpu个数、每个cpu的核心数、cpu型号

  1、逻辑cpu个数(线程数) [root@centos79 test]# cat /proc/cpuinfo | grep "processor" processor : 0 processor : 1 processor : 2 processor : 3 [root@centos79 test]# cat /proc/cpuinfo | grep "processor" | wc -l 4   2、物理cp

linux系统中sed命令删除指定行后的下一行

1、测试数据 [root@centos79 test]# cat a.txt 3 4 5 d g 3 s g 8 k s g 2 5 d s c w a r t s c E a R t e 4 s   2、删除包含字符k后的一行 [root@centos79 test]# cat a.txt 3 4 5 d g 3 s g 8 k s g 2 5 d s c w a r t s c E a R t e 4 s [root@centos79 test]# sed '/k/{n

linux系统中删除文件的最后几行

1、测试数据 [root@centos79 test]# ls a.txt [root@centos79 test]# cat a.txt 3 4 5 d g 3 s g 8 k s g 2 5 d s c w a r t e 4 s   2、head命令删除最后三行 [root@centos79 test]# cat a.txt 3 4 5 d g 3 s g 8 k s g 2 5 d s c w a r t e 4 s [root@centos79 test]# head

linux系统中sed命令在指定行前(后)插入内容

1、测试数据如下: [root@centos79 test]# ls a.txt [root@centos79 test]# cat a.txt 3 4 5 d g 3 s g 8 k s g 2 5 d s c w a r t e 4 s   2、在第2行后插入xxxx [root@centos79 test]# cat a.txt 3 4 5 d g 3 s g 8 k s g 2 5 d s c w a r t e 4 s [root@centos79 test]# sed

linux系统中sed命令整行替换

1、测试数据 [root@centos79 test]# cat a.txt 3 4 5 d g 3 s g 8 k s g 2 5 d s c w a r t e 4 s   2、将第2行替换为xxxx [root@centos79 test]# cat a.txt 3 4 5 d g 3 s g 8 k s g 2 5 d s c w a r t e 4 s [root@centos79 test]# sed '2c xxxx' a.txt 3 4 5 xxxx s g 8

linux系统中sed命令删除指定行及其后的若干行

1、测试数据 [root@centos79 test]# cat a.txt 3 4 5 d g 3 s g 8 k s g 2 5 d s c w a r t e 4 s   2、删除匹配k的行及其后2行 [root@centos79 test]# cat a.txt 3 4 5 d g 3 s g 8 k s g 2 5 d s c w a r t e 4 s [root@centos79 test]# sed '/k/,+2d' a.txt 3 4 5 d g 3 s

plink软件计算位点杂合度和样本杂合度

杂合度计算分为两种:位点杂合度和样本杂合度 1、计算位点杂合度,测试数据如下: [root@centos79 test]# ls outcome.map outcome.ped [root@centos79 test]# cat outcome.map ## 8个snp位点 1 snp1 0 55910 1 snp2 0 85204 1 snp3 0

linux系统中find命令

linux系统中find命令 1、直接查找文件名 测试文件如下: [root@centos79 test]# ls 01.txt 02.csv 02.txt 03.csv 04.txt [root@centos79 test]# find "02.txt" 02.txt [root@centos79 test]# find *.csv 02.csv 03.csv   2、find后加查找的路径、 使用-name参数指定文件名

linux系统中tr命令

  1、tr命令 -s 参数将多个连续的字符压缩为一个字符 [root@centos79 test]# ls a.txt [root@centos79 test]# cat a.txt aaabbbaaaccc a a bbbb ddddcccc [root@centos79 test]# tr -s abcd < a.txt ## 将任一连续的a、b、c、d字符压缩为一个字符 abac a a b dc   [root@

linux系统中在指定行后添加空行

1、在所有行后添加空行 [root@centos79 test]# cat a.txt a g r e i x k like a f g liker s t 2 a b d s i [root@centos79 test]# awk '{print $0 "\n"}' a.txt a g r e i x k like a f g liker s t 2 a b d s i   2、 [root@centos79 test]# cat a.txt a

linux系统中如何将多个连续的空行合并为一个空行

1、测试数据如下 [root@centos79 test]# ls a.txt [root@centos79 test]# cat a.txt a g r e i x k like a f g liker [root@centos79 test]# cat -A a.txt a g r e$ $ $ $ $ i x k like$ a f g liker$   2、将多个空行合并为一个空行 [root@centos79 test]# ls a.txt [ro

linux系统中如何删除空行

linux系统中如何删除空行。 1、测试数据 a.txt [root@centos79 test]# ls a.txt [root@centos79 test]# cat a.txt a g r e i x k like a f g liker [root@centos79 test]# cat -A a.txt a g r e$ $ ## 空行什么也没有 i x k like$ a f g liker$ [root@centos79