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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T16:57:53+00:00 2026-05-30T16:57:53+00:00

I have a script file that uses import and load commands to bring in

  • 0

I have a script file that uses import and load commands to bring in scripts from other files. I am trying to convert these scripts to a new language but it is hard to follow the variables through all of the different imports/loads. I am trying to write a BASH script to go through a file and import all the text from the included/imported files inline where it was called.

Final Solution Used!

sed -e 's/\\/\//g' test.restomatic | awk '{if ($1 ~ /^(LOAD|IMPORT)/) system("cat " $2); else print;}' > /cygdrive/c/bashScripts/testing.txt

Sample of Original File:

LOAD ..\..\..\..\GlobalSuccess\IdentityShardCreate_Success.rcq
REPLACE /rest-client/request/url/*shard* "//{$OKEnv}"
EXPECT HEADER SERVER
EXPECT HEADER DATE
EXPECT RETURN-CODE 201
RUN
IMPORT ..\..\..\..\GlobalSuccess\IdentityEnvironmentCreateNewEnvironmentFromShard_Success.rcq
REPLACE /rest-client/request/url/*shard* "//{$OKEnv}/environment"
EXPECT HEADER Server
EXPECT HEADER Date
EXPECT RETURN-CODE 204
RUN
ASSIGN ShardTypeControl 1
LOOP ShardTypeControl
ASSIGN OKShard2 {$ShardNames[{$ShardTypeControl}]}
LOAD ..\..\..\..\GlobalSuccess\IdentityEnvironmentAddShardToEnvironment_Success.rcq
REPLACE /rest-client/request/url/*shard* "//{$OKShard2}/environment/{$OKEnv}"

Example of desired results of output file:

Original File (OF) Start
(OF) Line 1
(OF) Line 2
(OF) Line 3
Line 1 of Imported File - would have been (OF) line 4
Line 2 of Imported File
(OF) Line 5
(OF) Line 6
Line 1 of Loaded File - would have been (OF) line 7
Line 2 of Loaded File
Line 3 of Loaded File
(OF) Line 8
Line 1 of Second Imported File - would have been (OF) line 9
Line 2 of Second Imported File
  • 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-30T16:57:54+00:00Added an answer on May 30, 2026 at 4:57 pm

    All this can be combined in single awk command like this:

    awk '{if ($1 ~ /^(LOAD|IMPORT)/) {gsub(/\\/, "/", $2); system("cat " $2)} else print}' test.txt > output.txt
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a Perl script that uses WWW::Mechanize to read from a file and
I have a script that will convert a text file into a resource file,
I have a Perl script that works on Windows XP. It uses File::Copy's move
I have an external JS file that I load into my HTML <script type=text/javascript
I have a php script that uses curl to download a remote file. Let's
I have a PHP script that does the following: Uses file_get_contents() to get content
I have a shell script file (run.sh) that contains the following: #!/bin/bash %JAVA_HOME%/bin/java -jar
I have a PHP script that processes file uploads. The script tries to organise
I have an xml file that I want to configure using a bash script.
I have a script that takes a table name and generates a control file

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.