Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Organizing columns with AWK

Status
Not open for further replies.

Guest_imported

New member
Jan 1, 1970
0
Hello all...new to AWK and trying to learn, so help would be appreciated here :) Here's my problem:

File1 has 3 columns of data delimitted by quotes. I need to grab the middle column and append it to file2 in the form of 6 columns in 6E13.5 format.

I'm not sure if AWK is even the right command to be looking at, so any other ideas would be great.

Thanks!
 

Hi gpburdell01!

I didn't quite understand your question, but I give you some suggestions. You can grab second column of file delimitted by quotes with this awk example

Code:
BEGIN  { FS = "'" }

{ print $2 > "file2" }

or this awk command

Code:
awk -F' '{ print $2 }' inputfile > file2

You can also post an example of your data.

Bye!

KP.
 
Maybe this is what you want?

BEGIN {FS="'"}
{
printf("%13.5e",$2)
ix++
if (ix == 6) {
printf("\n")
ix = 0
}
}
END{ printf("\n") }

If not, post some sample input data and the output you expect.

CaKiwi
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top