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 8499327
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T00:38:12+00:00 2026-06-11T00:38:12+00:00

I write now an AWK function, that should look like: function inser_styles(path_to_files, output_file) {

  • 0

I write now an AWK function, that should look like:

  function inser_styles(path_to_files, output_file) {
    for each input_file in path_to_files {
      print "" > output_file;
      while ( getline < input_file ) {
        print "   " $0 > output_file;
      }
    }
    print "" > output_file;
  }

It shoud read files from some path_to_files directory and put all the content of each input_file into some output_file, separated with empty line.

How could the for each input_file in path_to_files {...} – loop look like? Does the awk support this kind of for-loop or should I read the filename array with extern execute of ls?

  • 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-06-11T00:38:13+00:00Added an answer on June 11, 2026 at 12:38 am

    You can use the find utility to get the filenames. Note that this will not work properly if filenames contain newlines. Specify any additional options that you’d like to use with find.

    function insert_styles(path_to_files, output_file) {
        cmd = "find " path_to_files " -maxdepth 1 -type f"
        while (cmd | getline input_file > 0) {
            print "" > output_file;
            while ( getline < input_file ) {
                print "   " $0 > output_file;
            }
            close(input_file)
        }
        close(cmd)
        print "" > output_file;
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Right now I'm trying to write a function to moving up frame when keyboard
So right now I'm using something like this in C#: Response.Write(Server.HtmlEncode(line)); This will grab
So right now I've developed an application that I'm trying to write an API
I have a command that looks like this: ps v -p 2585 | awk
I am trying to write an awk script that can get a block that
write now, I am working on an app that is based on an application
I define Sql_Cmd And Other sql variable that need before and Now write this
I'm using Threading.Timer, like: new System.Threading.Timer( new System.Threading.TimerCallback(x=> file.Write(DateTime.Now.ToString()) ), null, 0, 600000); And,
so write now my Url looks like domain.com\MyAction?var1=x&var2=y&var3=z. Now, in order to make it
In a program that I'm trying to write now I take two columns of

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.