删除csv文件的第一列 [英] Delete first column of csv file

查看:732
本文介绍了删除csv文件的第一列的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想知道如何使用awk或sed删除csv文件的第一列

I would like to know how i can delete the first column of a csv file with awk or sed

类似这样的东西:

FIRST,SECOND,THIRD

对于类似的东西

SECOND,THIRD

预先感谢

推荐答案

遵循awk可以帮助您.

Following awk will be helping you in same.

awk '{sub(/[^,]*/,"");sub(/,/,"")} 1'   Input_file

遵循sed可能也会帮助您.

Following sed may also help you in same.

sed 's/\([^,]*\),\(.*\)/\2/'  Input_file

说明:

Explanation:

awk '                 ##Starting awk code here.
{
  sub(/[^,]*/,"")     ##Using sub for substituting everything till 1st occurence of comma(,) with NULL.
  sub(/,/,"")         ##Using sub for substituting comma with NULL in current line.
}
1                     ##Mentioning 1 will print edited/non-edited lines here.
'   Input_file        ##Mentioning Input_file name here.

这篇关于删除csv文件的第一列的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆