Awk has a full blown scripting language built into it and is best used when dealing with data that is in rows and columns.
Sed is a stream editor. It also has its own programming language, but it is a little more crude/basic. And primarily deals with transforming text - search/replace operations etc.
It’s possible to write an executable awk script and set awk as its interpreter, using a shebang line at the start of the script.
And then when you run the script in the terminal/shell, awk will be used to interpret the script.
To run your awk script:
/path/to/awkscript /path/to/input-file > /path/to/outputfile
And I think you can do it with sed too.
And to run the script, you do the same kind of thing:
/path/to/sedscript /path/to/input-file > /path/to/output-file
By default sed outputs everything to stdout. So you’ll need to redirect the output to a new file.
Alternatively, if you want the original file to be edited "in place" by sed, add the -i option to the shebang line in your script BEFORE the -f option:
Then you’d run the sed script like this:
And the sed script will run and will process the input-file, modifying the original file.
Though the ability to use sed like this may depend on which version of sed you’re using. Some versions of sed do not support the use of the -f option. I can’t remember if GNU sed is one of them!
Assuming GNU sed does work with the -f option, then yes, it can be used by bash as an interpreter for sed scripts.
If that’s what you meant by a command line interpreter?!
Just like you can use the shebang to specify Ruby as an interpreter for Ruby scripts. Or Python for Python. Or lci for interpreting lolcode scripts - a scripting language that uses lolcat meme influenced phrases (I CAN HAZ CHEEZBURGER?!). Or chef for interpreting chef scripts, where programs are delicious recipes! (Not to be confused with the chef that’s used by dev-ops in the cloud!)
These are actual scripting languages!!
You can actually build and install interpreters for them and create working programs with them!
Not particularly useful programs, they aren’t really very productive languages to use. But they can be a bit of fun way to flex your brain!
I went off on a bit of a tangent there - sorry about that! Ha ha!