[LINUX] sed command

sed command

I didn't understand it well, so I summarized it briefly.

What is the sed command?

"Sed" is an abbreviation for "Stream EDitor"

sed -Optional script command input file

With the above command Processes the specified file according to the command and outputs it to the standard output.

option Right align
-r In script(Not a basic regular expression)Use extended regular expressions
-f script file Add the contents of the script file as a command to execute
-escript Add script
-i Replace the original file with the output instead of outputting to standard output

Example

Change "abc" in the file to "ABC"

sed s/adc/ABC file name

When there is no option

The first argument is treated as a sed script and all remaining arguments are treated as input files.

In / etc / shells, replace the place where "usr" is written with "USER"

sed s/user/USER/ /etc/shells
    #script#file name

It was easy, but like this, Now that I understand what it is like, I would like to make it usable.

Recommended Posts

sed command
Linux command # 4
Linux command # 3
nkf command
command prompt
sed memo
vim command
Linux command # 5
grep command
command memo
top command
Command memorandum
Command memo
mv command
seq command
Roughly systemctl command
Linux command list
linux at command
ls command options
[Linux] Search command
Memorandum of sed
Linux command <Basic 2>
First command plugin
pip command collection
scp command memo
nc command memorandum
Linux [directory command]
who command memo
Linux server command
Linux # Command Memo 1
Linux command [read]
Linux Command Summary
[Basic] linux command
Linux [shell command]
Convenient command combination
[Linux] Command / Knowledge
IPF command information
My linux command
Future nl command
Memorandum conda command
Linux command <Basic 1>
ps command "wchan"
setuptools command memorandum
Django + Docker command
Broken pip command
Linux command collection
Linux mkdir command
Linux command basics
[Linux] Git command
Docker command summary
Linux (command memory)
DNS dig command
How to delete the specified string with the sed command! !! !!