awk filter by one col larger than a value

1
awk -F'\t' '$36 > "2017-10-18 15:00:00" {print ;}' 13224_sample_material_encode_full | sort -r > target.txt

打印第36列大于某一时刻的整行

1
'$36 > "2017-10-18 15:00:00" {print ;}'

filter: $36 > "2017-10-18 15:00:00"

print whole line: print ;

awk/cut 输出指定列

1
awk '{for(i=10;i<=20;i++)printf $i""FS;print""}' file

FS就是分隔符

1
cut -d" " -f 10-20 file

百度知道

逆序

sort reverse: sort -r

按某列排序

sort -k 2 file.txt
按第二列排序
stackoverflow

Chinese punctuation to English punctuation

Python中:中文标点转换成英文标点

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
# In Python3, use str.maketrans instead
table = {ord(f):ord(t) for f,t in zip(
u',。!?【】()%#@&1234567890',
u',.!?[]()%#@&1234567890')}
t = u'中国,中文,标点符号!你好?12345@#【】+=-()'
t2 = t.translate(table)
'''
>>> print t2
中国,中文,标点符号!你好?12345@#[]+=-()
'''
作者:灵剑
链接:https://www.zhihu.com/question/37720196/answer/115870233
来源:知乎
著作权归作者所有。商业转载请联系作者获得授权,非商业转载请注明出处。

链接

use sed print certain lines

用sed命令

sed -n ‘5,10p’ filename 这样你就可以只查看文件的第5行到第10行。

linux 如何显示一个文件的某几行(中间几行)

sed第一行、第二行至最后

最后添加一列

1
2
3
4
5
cmd_str = 'sed -i "1s/$/\t%s-mirror/" %s' % (str(file_col_num + 1),
cmd_str = 'sed -i "1s/$/\tmirror/" %s' % local_upload_sample_file_path_name
cmd_str = 'sed -i \'2,$s/$/\t0/\' %s' % local_upload_sample_file_path_name
cmd_str = 'sed -i \'1d %s\'' % local_upload_sample_file_path_name2
cmd_str = 'sed -i \'s/$/\t1/\' %s' % local_upload_sample_file_path_name2

Adding a Column of values in a tab delimited file

linux中sed的用法