Improve company productivity with a Business Account.Sign Up

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 774
  • Last Modified:

Grep output to columns

I know how to extract a field to a log file using:
% grep something filename | awk '{print $3}' > output.log

filename:
06/07, something TEST1 TEST2 blah blah TEST4

Is there a way to output 2 or more fields to a file in columns.

Output.log with $3 $4 $7:

TEST1 TEST2 TEST4
.
.
.
Thanx



0
RudePuppyDog
Asked:
RudePuppyDog
  • 2
1 Solution
 
joolsCommented:
Do you mean;

grep something filename | awk '{print $3" "$4" "$7}' > output.log

or formatted output for variable length fields?
0
 
RudePuppyDogAuthor Commented:
That is exactly what I meant ... cant believe it was that easy.  Brain Freeze.  Thanx
0
 
joolsCommented:
Cool, I can't believe it was that easy either!! :-)
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now