Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people, just like you, are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
Solved

Grep output to columns

Posted on 2002-07-26
3
716 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

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.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Expand macro to include alternate header placement and naming 5 75
Expand LInux Boot partition remotly 3 96
Separate into files by filename 12 87
wordcount challenge 11 132
Introduction: Load and Save to file, Document-View interaction inside the SDI. Continuing from the second article about sudoku.   Open the project in visual studio. From the class view select CSudokuDoc and double click to open the header …
Introduction: Dialogs (1) modal - maintaining the database. Continuing from the ninth article about sudoku.   You might have heard of modal and modeless dialogs.  Here with this Sudoku application will we use one of each type: a modal dialog …
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.
Finds all prime numbers in a range requested and places them in a public primes() array. I've demostrated a template size of 30 (2 * 3 * 5) but larger templates can be built such 210  (2 * 3 * 5 * 7) or 2310  (2 * 3 * 5 * 7 * 11). The larger templa…

856 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