Solved

Grep output to columns

Posted on 2002-07-26
3
675 Views
Last Modified: 2013-12-26
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
Comment
Question by:RudePuppyDog
  • 2
3 Comments
 
LVL 19

Accepted Solution

by:
jools earned 50 total points
ID: 7180641
Do you mean;

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

or formatted output for variable length fields?
0
 

Author Comment

by:RudePuppyDog
ID: 7180824
That is exactly what I meant ... cant believe it was that easy.  Brain Freeze.  Thanx
0
 
LVL 19

Expert Comment

by:jools
ID: 7181692
Cool, I can't believe it was that easy either!! :-)
0

Featured Post

Threat Intelligence Starter Resources

Integrating threat intelligence can be challenging, and not all companies are ready. These resources can help you build awareness and prepare for defense.

Join & Write a Comment

Introduction: Dialogs (2) modeless dialog and a worker thread.  Handling data shared between threads.  Recursive functions. Continuing from the tenth article about sudoku.   Last article we worked with a modal dialog to help maintain informat…
If you use Adobe Reader X it is possible you can't open OLE PDF documents in the standard. The reason is the 'save box mode' in adobe reader X. Many people think the protected Mode of adobe reader x is only to stop the write access. But this fe…
This video will show you how to get GIT to work in Eclipse.   It will walk you through how to install the EGit plugin in eclipse and how to checkout an existing repository.
It is a freely distributed piece of software for such tasks as photo retouching, image composition and image authoring. It works on many operating systems, in many languages.

707 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

16 Experts available now in Live!

Get 1:1 Help Now