There are many ways to add a Linux string. One is to add a string at the beginning and end of the text. This article will introduce Linux's method of adding strings using the sed command.
command beginning or end of a row of characters by adding sed command are the following:
text processing is assumed test.file
in each row Add characters to the header, such as “HEAD”, the command is as follows:
sed ‘s/^/HEAD&/g’ test.file
Add characters at the end of each line. such & ldquo; TAIL & rdquo ;, the following commands:
sed & lsquo; s /$ /& TAIL /g & rsquo; test.file
FIG results are as follows:
A few notes:
1.“^” stands at the beginning of the line, “$” stands for the end of the line
2.‘s/$/&TAIL/g’ The character g in the middle represents the replacement of all characters appearing in each line. If you want to add it at a specific character, g is useful. Otherwise, only the first one of each line will be replaced, and you will not find it later.
:
Previous 12 Next total 2
Linux has an error message when mounting a USB flash drive, suggesting mount: unkno
In Linux system operation, root usually does not set a password. Once the root password is set, you
Linux multi-path refers to the connection between the host and the hard disk, and also includes the
In Linux, commands can be used to form dialog boxes. The dialog box formed by Linux command line is
What are the common commands for Linux rookie?
Linux system CentOS 7 to build a high-availability cluster method
The specific steps of installing Flash plugin in Firefox in Linux
Linux configuration SSH service method
How to create a video DVD in a Linux desktop environment
How does Ubuntu automatically switch between the mouse and the shared clipboard under VirtualBox?
Ubuntu prompts missing fonts after installing WPS. What should I do?
Linux vim comment color can't see how to change?
Tips for optimizing Mysql runtime environment on Linux
Solution for Lantern tool cannot be started under Linux system
Steps to back up Ubuntu system
How Linux sets up port forwarding for intranet access to intranet
Ubuntu 12.04 boot error saned disabled solution
How to install and configure Vim IDE for Linux systems
How to quickly uninstall Win8 application
10 tips for optimizing Windows 7
Win8.1 can be used to switch accounts without logging off and restarting.
Linux error when reporting a scheduled task -bash:crontab:command?
Let Windows 7 automatically update and restart prompts no longer reproduce