Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7159209
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T13:11:35+00:00 2026-05-28T13:11:35+00:00

I need to export some numeric values from a given ASCII text file and

  • 0

I need to export some numeric values from a given ASCII text file and export it in a specific formatted csv file. The input file has got the even / odd line pattern:

 SCF Done:  E(UHF) =  -216.432419652     A.U. after   12 cycles
 CCSD(T)= -0.21667965032D+03
 SCF Done:  E(UHF) =  -213.594303492     A.U. after   10 cycles
 CCSD(T)= -0.21379841974D+03
 SCF Done:  E(UHF) =  -2.86120139864     A.U. after    6 cycles
 CCSD(T)= -0.29007031339D+01
 and so on

I need the odd line value in the 5th column and the even line 2nd column value. They should be printed in a semicolon seperated csv file, with 10 values in each row. So the output should look like

-216.432419652;-0.21667965032D+03;-213.594303492;-0.21379841974D+03;-2.86120139864;-0.29007031339D+01; ...linebreak after 5 pairs of values

I started with awk '{print $5}' and awk '{print $2}', however I was not successful in creating a pattern that just acts on even/odd lines.

A simple way to do that?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-28T13:11:35+00:00Added an answer on May 28, 2026 at 1:11 pm

    The following script doesn’t use a lot of the great power of awk, but will do the job for you and is hopefully understandable:

    NR % 2 { printf "%s;", $5 }
    NR % 2 == 0 { printf "%s;", $2 }
    NR % 10 == 0 { print "" }
    END { print "" }
    

    Usage (save the above as script.awk):

    awk -f script.awk input.txt
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

i need to export data from a table to a csv. i have the
I need to Export some PNG Images with Transparent Background from a C# Application
I need to export some data from PostgreSQL to Excel (quick customer wish), and
I have a script to export data from MYSQL to a CSV file. the
In my application iOS I need to export some data into CSV or HTML
I need to export all of the objects from my MDB to text files
I need to export some project from a repo at my work, im using
I need to export a report to Excel file using PHP i.e. on the
being in need to export a DOC file to TXT and then reimport it
I need a solution to export a dataset to an excel file without any

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.