1

how to move a header to the last column, using awk or sed input file look like this:

Line      1.000N
x y z 
23.88  44.66  56.6
23.81  41.66  53.6
Line      81.000N
x y z 
13.88  34.66  56.6
13.81  41.66  43.6

I would like the output to be in the following format:

23.88  44.66  56.6  1.000N
23.81  41.66  53.6  1.000N
13.88  34.66  56.6   81.000N
13.81  41.66  43.6   81.000N
1
  • To be able to help there you'll likely need to show at least the printf line of code you're using. You may have an END line too, hard to help without seeing the code. Commented Dec 6, 2014 at 21:40

1 Answer 1

1

Something like this maybe?

awk '/^Line/ {hdr=$2;getline;next} {print $0,hdr}' yourfile
23.88  44.66  56.6 1.000N
23.81  41.66  53.6 1.000N
13.88  34.66  56.6 81.000N
13.81  41.66  43.6 81.000N

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.