Please select To the mobile version | Continue to access the desktop computer version


Hot search: orangepi
View: 1286|Reply: 0

Linux most powerful sed stream processing editor, command format

[Copy link]








Rank: 9Rank: 9Rank: 9

Post time 2017-5-27 18:57:24 | Show all posts |Read mode
Sed Execution Process
sed processes one line at a time without changing the contents of the file
sed defaults to printing after each line of data that has been processed
Read which line will first do regular matching. If it matches, let the SED command handle it, or it will be output directly to the screen
sed Using Method--Command Line Format
sed [-e,-n] 'Line location (regular)+sed command(operation)' file(s)
sed Using Method--Command Line Format parameter-e
-e calls two sed command
sed Using Method--Command Line Format-n
Indicates that the default print operation for sed is inhibit
If there is no -n added on,

If adding parameter of-n:
$sed -n '/root/p' passwd
It will output only one line, some people think that the sed command output is output two times, actually it is not two times output, it is the sed command itself will output all read lines. And the P command will print out the matching line, and -n can inhibit the printing behavior of sed by default.
sed Using Method--Command Line Format sed command p
Print out all the matching lines

This post contains more resources

You have to Login for download or view attachment(s). No Account? Register

You have to log in before you can reply Login | Register

Points Rules

Archiver|Mobile edition|Darkroom|OrangePi En ( 粤ICP备14086627号-2

2020-6-6 11:19 GMT+8 , Processed in 0.027390 second(s), 28 queries .

Powered by Discuz! X3.2

© 2014-2015 orangepibbs en.

Quick Reply To Top Return to the list