In my tab delimited file temp.txt
it looks like the following
field1 field2 field3 field4 field5 field6
field1 field2 field3 field4 field5 field6 field7
field1 field2 field3 field4 field5 field6 field7 field 8
As per your update, I strongly recommend using cut
:
cut -f6- temp.txt
will print field6 to end of line.
Note -d
specifies the delimiter, but tab is the default delimiter.
You can do this in awk
, but I find cut
to be simpler.
With awk
it would look like this:
awk '{print substr($0, index($0, $6))}' temp.txt
if my tab delimited file temp.txt looks like the following
field1 field2 field3 field4 field5 field6
field1 field2 field3 field4 field5 field6 field7
field1 field2 field3 field4 field5 field6 field7 field 8
awk -F"" '{print $6}' temp.txt
will print only the 6th field. if the delimiter is tab it will likely work without setting -F, but I like to set my field-separator when I can.
similarly so too would cut.
cut -f6 temp.txt
I have a hunch your question is a bit more complicated then this, so if you respond to my comment I can try and expand on my answer.
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…