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

OrangePi

 Login            
 Register            
Search
Hot search: orangepi
View: 1088|Reply: 0

Linux most powerful sed stream processing editor, command format

[Copy link]

55

Threads

657

Posts

3661

Credits

Administrator

Rank: 9Rank: 9Rank: 9

Credits
3661
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
root:x:0:0:root:/root:/bin/bash
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

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

Points Rules

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

2019-10-23 20:40 GMT+8 , Processed in 0.030775 second(s), 28 queries .

Powered by Discuz! X3.2

© 2014-2015 orangepibbs en.

Quick Reply To Top Return to the list