Looking, it turns out on my system there is an envsubst
command which is part of the gettext-base package.
So, this makes it easy:
envsubst < "source.txt" > "destination.txt"
Note if you want to use the same file for both, you’ll have to use something like moreutil’s sponge
, as suggested by Johnny Utahh: envsubst < "source.txt" | sponge "source.txt"
. (Because the shell redirect will otherwise empty the file before its read.)
Related Posts:
- How can I recursively find all files in current and subfolders based on wildcard matching?
- How to perform grep operation on all files in a directory?
- subprocess.Popen(): OSError: [Errno 8] Exec format error in python?
- How can I recursively find all files in current and subfolders based on wildcard matching?
- Curl command for https ( SSL )
- How to exclude a directory in find . command
- “sed” command in bash
- How to exclude a directory in find . command
- Shell command to tar directory excluding certain files/folders
- Pseudo-terminal will not be allocated because stdin is not a terminal
- Given two directory trees, how can I find out which files differ by content?
- Diff command along with Grep gives “Binary file (standard input) matches”
- Pseudo-terminal will not be allocated because stdin is not a terminal
- screen Cannot open your terminal ‘/dev/pts/0’ – please check
- ./configure : /bin/sh^M : bad interpreter
- What is the difference between “#!/usr/bin/env bash” and “#!/usr/bin/bash”?
- Is there a “goto” statement in bash?
- Implementing shell in C and need help handling input/output redirection
- Command to change the default home directory of a user
- Writing a simple shell in C using fork/execvp
- Implementation of multiple pipes in C
- chmod: changing permissions of ‘my_script.sh’: Operation not permitted
- What does “&” at the end of a linux command mean?
- What does set -e mean in a bash script?
- What does set -e mean in a bash script?
- Syntax error near unexpected token ‘then’
- How to use sed to extract substring
- How do I know the script file name in a Bash script?
- Shell command to monitor changes in a file
- What is “-bash: !”: event not found”
- What does ‘set -e’ do, and why might it be considered dangerous?
- How to add a timestamp to bash script log?
- Colors in bash after piping through less?
- How can I kill all stopped jobs?
- How to run command as user who has /usr/sbin/nologin as Shell?
- Is there a way to do a remote “ls” much like “scp” does a remote copy?
- How do I join two named pipes into single input stream in linux
- Amazon Linux: apt-get: command not found
- How do I find all files containing specific text on Linux?
- “Couldn’t find a file descriptor referring to the console” on Ubuntu bash on Windows
- Where can I find php.ini?
- gzip: stdin: not in gzip format tar: Child returned status 1 tar: Error is not recoverable: exiting now
- How to install grub after installing Windows 10
- Linux: ‘Username’ is not in the sudoers file. This incident will be reported
- “E: Unable to locate package python-pip” on Ubuntu 18.04 [duplicate]
- -bash: syntax error near unexpected token `newline’ for display command
- SSH using python script
- mysql_config not found when installing mysqldb python interface
- Linux error while loading shared libraries: cannot open shared object file: No such file or directory
- QEMU: /bin/sh: can’t access tty; job control turned off
- Meaning of exit status 1 returned by linux command
- How does “cat << EOF" work in bash?
- X11 forwarding request failed on channel 0
- How can I kill a process by name instead of PID, on Linux?
- Extract file basename without path and extension in bash
- How to change permissions for a folder and its subfolders/files in one step
- mysql_config not found when installing mysqldb python interface
- linux command to get size of files and directories present in a particular folder?
- Compile the Fortran program in Windows using gfortran
- How can I set the ‘backend’ in matplotlib in Python?
- Yum fails with – There are no enabled repos.
- How to get the process ID to kill a nohup process?
- Unable to establish SSL connection upon wget on Ubuntu 14.04 LTS
- configure: error: cannot run C compiled programs
- “find: paths must precede expression:” How do I specify a recursive search that also finds files in the current directory?
- Pipe to/from the clipboard in a Bash script
- Difference between exec, execvp, execl, execv?
- what does -zxvf mean in tar -zxvf filename?
- Retrieve last 100 lines logs
- Configuring Apache for localhost
- Restarting cron after changing crontab file?
- cd into directory without having permission
- WordPress can’t find temporary folder, but folder it’s looking at has correct permissions
- WordPress cloning issue
- Can scp copy directories recursively?
- What are the functional differences between .profile .bash_profile and .bashrc
- Why does my hostname appear with the address 127.0.1.1 rather than 127.0.0.1 in /etc/hosts?
- Linux command to inspect TXT records of a domain [closed]
- df in linux not showing correct free space after file removal
- Setting the hostname: FQDN or short name?
- What does a + mean at the end of the permissions from ls -l?
- What version of RHEL am I using?
- How do you make it obvious you are on a production system?
- How can I verify if TLS 1.2 is supported on a remote web server from the RHEL/CentOS shell?
- Mount CIFS Host is down
- List of files installed from apt package
- How to copy a large number of files quickly between two servers
- Allow SFTP but disallow SSH?
- How can I export the privileges from MySQL and then import to a new server?
- Is there a directory equivalent of /dev/null in Linux?
- Can I send some text to the STDIN of an active process running in a screen session?
- How can I get processor/RAM/disk specs from the Linux command Line? [duplicate]
- Is there a way to see the execution tree of systemd?
- How to determine the hostname from an IP address in a Windows network?
- create home directories after create users
- How do I redirect subdomains to a different port on the same server?
- Running Cron every 2 hours [duplicate]
- How to check the physical status of an ethernet port in Linux?
- What does “debconf: delaying package configuration, since apt-utils is not installed” mean?
- In Linux, what is the difference between “buffers” and “cache” reported by the free command?