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的用法