How to delete columns?
how does your cut
command look like?
$ cut -d" " -f1,6- filefe120b99164f151b28bf86afa6389b22 186 2010-03-14 19:26 Descript.txt41705ea936cfc653f273b5454c1cdde6 30 2010-03-14 20:29 listof.txt0e25cca3222d32fff43563465af03340 28 2010-03-14 23:35 sedexample.txtd41d8cd98f00b204e9800998ecf8427e 0 2010-02-16 15:11 test1.txtd41d8cd98f00b204e9800998ecf8427e 0 2010-02-16 15:11 test2.txtd41d8cd98f00b204e9800998ecf8427e 0 2010-02-16 15:11 test3.txtd41d8cd98f00b204e9800998ecf8427e 0 2010-02-16 15:11 test4.txtd41d8cd98f00b204e9800998ecf8427e 0 2010-02-16 15:11 test5.txtd41d8cd98f00b204e9800998ecf8427e 0 2010-02-16 15:11 test6.txtf5c7f1856249d0526be10df5bd5b895a 26 2010-03-13 14:13 testingfile.txtd41d8cd98f00b204e9800998ecf8427e 0 2010-03-15 00:28 uniquelist.txt
redirect to new file as needed.
Or awk
$ awk '{$2=$3=$4=$5="";gsub(/ +/," ")}1' filefe120b99164f151b28bf86afa6389b22 186 2010-03-14 19:26 Descript.txt41705ea936cfc653f273b5454c1cdde6 30 2010-03-14 20:29 listof.txt0e25cca3222d32fff43563465af03340 28 2010-03-14 23:35 sedexample.txtd41d8cd98f00b204e9800998ecf8427e 0 2010-02-16 15:11 test1.txtd41d8cd98f00b204e9800998ecf8427e 0 2010-02-16 15:11 test2.txtd41d8cd98f00b204e9800998ecf8427e 0 2010-02-16 15:11 test3.txtd41d8cd98f00b204e9800998ecf8427e 0 2010-02-16 15:11 test4.txtd41d8cd98f00b204e9800998ecf8427e 0 2010-02-16 15:11 test5.txtd41d8cd98f00b204e9800998ecf8427e 0 2010-02-16 15:11 test6.txtf5c7f1856249d0526be10df5bd5b895a 26 2010-03-13 14:13 testingfile.txtd41d8cd98f00b204e9800998ecf8427e 0 2010-03-15 00:28 uniquelist.txt
Easily done as a shell pipe.
cut --delimiter=' ' --fields=3-5 --complement
If you really need to do this in C, you could run that command in a subprocess via popen
.
If you had mixed space and tab delimiters, you would need to convert one to the other as cut
does not like multiple delimiters. Do this with tr
or col -x
.