LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Red Hat (https://www.linuxquestions.org/questions/red-hat-31/)
-   -   how not to print the 4th field from a text file with six fields (https://www.linuxquestions.org/questions/red-hat-31/how-not-to-print-the-4th-field-from-a-text-file-with-six-fields-588163/)

livetoday 09-29-2007 03:19 AM

how not to print the 4th field from a text file with six fields
 
I have a file with six fields. However I do not want to print 4th field. Is there any way ?

kotnik 09-29-2007 04:00 AM

First thing that came to my mind:

awk '{ print $1 $2 $3 $5 $6 }' sixfieldfile.txt

livetoday 10-01-2007 12:39 AM

Yeah..surely I can do this...but it is cumbersome if I have to do the same thing in a file which contatins more then 15 fields and I just need to skip one....


Is there any option which tell awk not to print one of the field.

thanks....

Quote:

Originally Posted by kotnik (Post 2907322)
First thing that came to my mind:

awk '{ print $1 $2 $3 $5 $6 }' sixfieldfile.txt


kotnik 10-02-2007 01:19 PM

You can script in awk. I'd go with 'man awk' for a couple hours :)

I'm not that savvy with it...


All times are GMT -5. The time now is 04:43 PM.