前往小程序,Get更优阅读体验!
立即前往
首页
学习
活动
专区
工具
TVP
发布
社区首页 >专栏 >从csv等格式的数据中查询、导出、合并

从csv等格式的数据中查询、导出、合并

原创
作者头像
用户11153857
发布2024-06-10 13:26:00
760
发布2024-06-10 13:26:00
举报
文章被收录于专栏:自学笔记自学笔记

1. grep

grep is a powerful tool for query some pattern in a file.

grep is short for global regular expression print.

1.1 syntax

代码语言:linux
复制
grep [OPTION...] PATTERNS [FILE...] > [NEW FILE...]  
# > new file:存为new file,如果是已有文件名,将覆盖。    
# >> old file:追加到旧文件尾部。

1.2 options:

-i, --ignore-case: Ignores case distinctions in patterns and input data.忽略大小写

-v, --invert-match: Selects the non-matching lines of the provided input patterns.反向筛选

-n, --line-number: Prefix each line of the matching output with the line number in the input file.显示行号

-w: Find the exact matching word from the input file or string. 精确查找

-c: Count the number of occurrences of the provided pattern. 计数行数

2. head

head prints the first lines of one or more files (or piped data) to standard output.

2.1 syntax

代码语言:linux
复制
head [option] file_name

2.2 options

-n --lines show the specified number of lines

-c --bytes show the specified number of bytes

-v --verbose show the file name tag,to display the file name before outputting the first 10 lines

-q --quiet don't separate the content of multiple files with a file name tag

example,

代码语言:linx
复制
head -1 [options] file1.txt > file2.txt #把file1的第一行存为file2.txt。 

3. cat

cat is short for concatenate. 连接

3.1 syntax

代码语言:linux
复制
cat [options] [file_name]

example,

代码语言:linux
复制
cat file1.txt file2.txt > file3.txt  #将file1和file2合并,file1在前,存为file3.

3.2 options

-n Creates a numbered list with all lines, including blank lines.

原创声明:本文系作者授权腾讯云开发者社区发表,未经许可,不得转载。

如有侵权,请联系 cloudcommunity@tencent.com 删除。

原创声明:本文系作者授权腾讯云开发者社区发表,未经许可,不得转载。

如有侵权,请联系 cloudcommunity@tencent.com 删除。

评论
登录后参与评论
0 条评论
热度
最新
推荐阅读
目录
  • 1. grep
    • 1.1 syntax
      • 1.2 options:
      • 2. head
        • 2.1 syntax
          • 2.2 options
          • 3. cat
            • 3.1 syntax
              • 3.2 options
              领券
              问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档