LINUX CUT命令的介紹
LINUX CUT命令的介紹
使用cut命令獲取文檔中的某一列的數(shù)據(jù),例如下面的文件cut.tab中間使用tab鍵分隔,這里要想只顯示第3個(gè)列區(qū)域的內(nèi)容,可以使用 cut -f3 cut.tab實(shí)現(xiàn)。下面學(xué)習(xí)啦小編就跟大家說說LINUX CUT命令的說明,歡迎大家閱讀!!!
LINUX CUT命令的介紹
1用命令vi cut.tab創(chuàng)建一個(gè)cut.tab的文件
2在cut.tab文件中輸入如下內(nèi)容,單詞之間用tab作為分隔符。
3輸入:wq保存,并退出
4cat查看cut.tab文件的所有內(nèi)容
[lele@Oracle ~]$ cat cut.tab
one two three four five six seven
one two three four five six seven
one two three four five six seven
one two three four five six seven
one two three four five six seven
one two three four five six seven
one two three four five six seven
one two three four five six seven
one two three four five six seven
one two three four five six seven
one two three four five six seven
one two three four five six seven
one two three four five six seven
one two three four five six seven
one two three four five six seven
one two three four five six seven
one two three four five six seven
one two three four five six seven
one two three four five six seven
one two three four five six seven
one two three four five six seven
one two three four five six seven
one two three four five six seven
5使用cut命令,帶上-f參數(shù),例如下面是要查看cut.tab文件的第3列的內(nèi)容
[lele@Oracle ~]$ cut -f3 cut.tab
three
three
three
three
three
three
three
three
three
three
three
three
three
three
three
three
three
three
three
參數(shù)-f3的意思就是以tab鍵的空格為分隔符,截取第3段
6用cat cut.tab查看文件中的內(nèi)容,如果不保存,最后輸入:q即可退出。