LinuxQuestions.org
Support LQ: Use code LQ3 and save $3 on Domain Registration
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Red Hat
User Name
Password
Red Hat This forum is for the discussion of Red Hat Linux.

Notices

Reply
 
Search this Thread
Old 09-29-2007, 03:19 AM   #1
livetoday
Member
 
Registered: Jun 2006
Location: India
Distribution: RHEL,Suse,Fedora
Posts: 106

Rep: Reputation: 15
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 ?
 
Old 09-29-2007, 04:00 AM   #2
kotnik
Member
 
Registered: Nov 2004
Location: Novi Sad, Serbia
Distribution: Debian, Slackware, Gentoo, openSuSE
Posts: 254

Rep: Reputation: 31
First thing that came to my mind:

awk '{ print $1 $2 $3 $5 $6 }' sixfieldfile.txt
 
Old 10-01-2007, 12:39 AM   #3
livetoday
Member
 
Registered: Jun 2006
Location: India
Distribution: RHEL,Suse,Fedora
Posts: 106

Original Poster
Rep: Reputation: 15
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 View Post
First thing that came to my mind:

awk '{ print $1 $2 $3 $5 $6 }' sixfieldfile.txt
 
Old 10-02-2007, 01:19 PM   #4
kotnik
Member
 
Registered: Nov 2004
Location: Novi Sad, Serbia
Distribution: Debian, Slackware, Gentoo, openSuSE
Posts: 254

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

I'm not that savvy with it...
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Command to print last line of a text file Micro420 Linux - General 3 01-25-2007 01:17 AM
print a text file with long lines and line number added powah Linux - General 2 05-26-2006 02:02 PM
print text file to the console window, how? l.u Linux - Software 3 06-14-2005 02:54 PM
Can't enter text in certain Java text fields TheBelush Linux - Software 4 04-27-2005 05:29 PM
Print text file in html pages ariana Programming 1 11-12-2004 03:18 PM


All times are GMT -5. The time now is 08:34 PM.

Main Menu
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration