sed
is the Stream EDitor. It can do a whole pile of really cool things, but the most common is text replacement.
The s,%,$,g
part of the command line is the sed
command to execute. The s
stands for substitute, the ,
characters are delimiters (other characters can be used; /
, :
and @
are popular). The %
is the pattern to match (here a literal percent sign) and the $
is the second pattern to match (here a literal dollar sign). The g
at the end means to g
lobally replace on each line (otherwise it would only update the first match).
Related Posts:
- How to use sed to extract substring
- “Couldn’t find a file descriptor referring to the console” on Ubuntu bash on Windows
- 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?
- Pseudo-terminal will not be allocated because stdin is not a terminal
- ./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?
- Writing a simple shell in C using fork/execvp
- chmod: changing permissions of ‘my_script.sh’: Operation not permitted
- What does set -e mean in a bash script?
- What does set -e mean in a bash script?
- How do I know the script file name in a Bash script?
- What are the functional differences between .profile .bash_profile and .bashrc
- What is “-bash: !”: event not found”
- How to add a timestamp to bash script log?
- Colors in bash after piping through less?
- How to run command as user who has /usr/sbin/nologin as Shell?
- How do I deal with a filename that starts with the hyphen (-) character?
- Bash: No such file or directory?
- Cannot connect to the Docker daemon at unix:/var/run/docker.sock. Is the docker daemon running?
- apt-get error: Sub-process /usr/bin/dpkg returned an error code (1)
- error: ‘Can’t connect to local MySQL server through socket ‘/var/run/mysqld/mysqld.sock’ (2)’ — Missing /var/run/mysqld/mysqld.sock
- gzip: stdin: not in gzip format tar: Child returned status 1 tar: Error is not recoverable: exiting now
- 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?
- Pass a password to ssh in pure bash
- subprocess.Popen(): OSError: [Errno 8] Exec format error in python?
- “E: Unable to locate package python-pip” on Ubuntu 18.04 [duplicate]
- How to substitute shell variables in complex text files
- -bash: syntax error near unexpected token `newline’ for display command
- 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
- How to exclude a directory in find . command
- Shell command to tar directory excluding certain files/folders
- Explaining the ‘find -mtime’ command
- How does “cat << EOF" work in bash?
- WSL – GEDIT Unable to init server: Could not connect: Connection refused
- How to open some ports on Ubuntu?
- How can I kill a process by name instead of PID, on Linux?
- Extract file basename without path and extension in bash
- mv: cannot stat error : No such file or directory error
- Uncompress tar.gz file
- How to remove the quotes when reading a variable in jq in shell?
- screen Cannot open your terminal ‘/dev/pts/0’ – please check
- Trying to use bash on Windows and got no installed distributions message
- “Unable to find remote helper for ‘https'” during git clone
- -bash: fork: Cannot allocate memory
- Bash script: bad interpreter
- What is the difference between /etc/rc.local and ~/.bashrc?
- Implementing shell in C and need help handling input/output redirection
- How to count lines in a document?
- What does `set -x` do?
- Command to change the default home directory of a user
- How to get the process ID to kill a nohup process?
- Unable to establish SSL connection upon wget on Ubuntu 14.04 LTS
- sed command with -i option failing on Mac, but works on Linux
- Implementation of multiple pipes in C
- What does “&” at the end of a linux command mean?
- tar: add all files and directories in current directory INCLUDING .svn and so on
- wget returns “Unable to establish SSL connection”
- How do I install chkconfig on Ubuntu?
- make -j 8 g++: internal compiler error: Killed (program cc1plus)
- “find: paths must precede expression:” How do I specify a recursive search that also finds files in the current directory?
- Copy multiple files from one directory to another from Linux shell
- List all mounts in Linux
- Pipe to/from the clipboard in a Bash script
- Retrieve last 100 lines logs
- Retrieve last 100 lines logs
- How do I write stderr to a file while using “tee” with a pipe?
- How to include file in a bash shell script
- how to search for a directory from the terminal in ubuntu
- How to enable Bash in Windows 10 developer preview?
- What does ‘bash -c’ do?
- bash sh – command not found
- How to run a command multiple times, using bash shell?
- Shell command to monitor changes in a file
- Difference in sites-available vs sites-enabled vs conf.d directories (Nginx)?
- How do I prevent accidental rm -rf /*?
- How do I sleep for a millisecond in bash or ksh
- What does ‘set -e’ do, and why might it be considered dangerous?
- Keeping a linux process running after I logout
- What useful things can one add to one’s .bashrc? [closed]
- How can I kill all stopped jobs?
- How to display certain lines from a text file in Linux?
- Can you have more than one ~/.ssh/config file?
- GPG does not have enough entropy
- SSH from A through B to C, using private key on B [closed]
- Why don’t EC2 ubuntu images have swap?
- Heartbleed: how to reliably and portably check the OpenSSL version?
- How can I fully log all bash scripts actions?
- Is there a proper way to clear logs?
- Is there a way to do a remote “ls” much like “scp” does a remote copy?
- How to apply a filter to real time output of `tail -f `?
- How to remove invalid characters from filenames?
- zcat/gzcat works in linux, not on osx. general linux/osx compatibility
- How do I join two named pipes into single input stream in linux
- What is the debian-sys-maint MySQL user (and more)?
- How should an IT department choose a standard Linux distribution?