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

  • SEARCH
  • Home
  • 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 3845460
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 19, 20262026-05-19T16:14:52+00:00 2026-05-19T16:14:52+00:00

yesterday I asked the question how save the console output in a file (see

  • 0

yesterday I asked the question how save the console output in a file (see redirect only last line of STDOUT to a file). Now I iterate over files, compile them. Here is my command:

for REPORT in Test_Basic_*.scala; do
    scalac -Xplugin:divbyzero.jar $REPORT | awk 'END{print $REPORT} END{print}' >> output.txt
done

I want to save the last output of the compilation and the name of the file. In the example above only $REPORT will be saved but I want to refere to the name of the iteration variable.

For example I have the file Test_Condition.scala and run the command above:

for REPORT in Test_Basic_*.scala; do
    scalac -Xplugin:divbyzero.jar $REPORT | awk 'END{print $REPORT} END{print}' >> output.txt;
done

Then scalac -Xplugin:divbyzero.jar $REPORT produce the following output:

You have overwritten the standard meaning
Literal:()
rhs type: Int(1)
Constant Type: Constant(1)
We have a literal constant
List(localhost.Low)
Constant Type: Constant(1)
Literal:1
rhs type: Int(2)
Constant Type: Constant(2)
We have a literal constant
List(localhost.High)
Constant Type: Constant(2)
Literal:2
rhs type: Boolean(true)
Constant Type: Constant(true)
We have a literal constant
List(localhost.High)
Constant Type: Constant(true)
Literal:true
LEVEL: H
LEVEL: H
okay
LEVEL: H
okay
false
symboltable: Map(a -> 219 | Int | object TestIfConditionWithElseAccept2 | normalTermination | L, c -> 221 | Boolean | object TestIfConditionWithElseAccept2 | normalTermination | H, b -> 220 | Int | object TestIfConditionWithElseAccept2 | normalTermination | H)
pc: Set(L, H)

Now I want to save in output.txt Test_Condition.scala (name of the file) and pc: Set(L, H) (so the last line of the compilation output). With my command above I only save $REPORT pc: Set(L, H).

If this explanation is to complicated just tell me. Thanks for your great support.

Matthias

  • 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-19T16:14:53+00:00Added an answer on May 19, 2026 at 4:14 pm

    If I interpret your question correctly, you simply want a way to execute a command on a bunch of files and then store both the name of the file and the last line of the output of the command. This should work:

    : > output # clear out the output file
    for file in Test_Basic_*.scala; do
      printf "$file: " >> output
      scalac ... | awk 'END { print }' >> output
    done
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Yesterday I asked the question on how I should save my files. After some
Yesterday I asked another question to calculate time. Now I realized, that it makes
This problem is related to This question I asked yesterday. Now it seems that
Yesterday , I asked a question about socket post file data to php page.
I asked yesterday a question about css div positioning, now I solved my issue
Yesterday I asked a question on how to re-write SQL to do selects and
this is really strange, yesterday I asked the question Yesterdays question how to implement
Yesterday I asked this general question about decimals and their internal precisions. Here is
yesterday I just asked following question. How to customize tableView Section View - iPhone
I am trying to further a question I asked yesterday where I wanted to

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.