Created
August 23, 2022 16:33
-
-
Save coderofsalvation/b61ac5e94724630152112dc8f19e08d7 to your computer and use it in GitHub Desktop.
simple sourcecode preprocessor-file-import-include bundler using awk
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/bin/sh | |
| awk '/^#include *".*"$/ { | |
| i = index($0, "\""); | |
| file = substr($0, i + 1, length() - i - 1); | |
| while ((getline < file) == 1) print; | |
| close(file); | |
| next; | |
| } 1' myfile.txt > myfile.bundled.txt |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| other content |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| hello | |
| #import "foo.txt" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment