View: 4137|Reply: 1

Linux most powerful sed stream processing editor, command format

[Copy link]

62

threads

653

posts

5530

credits

Administrator

Rank: 9Rank: 9Rank: 9

credits
5530
Published in 2017-5-27 18:57:24 | Show all floors |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 thread contains more resources

You need to Log in to download or view,No account?    Register

x

0

threads

6

posts

58

credits

Registered member

Rank: 2

credits
58
Published in 2022-5-18 17:51:26 | Show all floors
Choosing the operating systems is more about the ease of usage rather than the attractiveness. I am a regular visitor of this site and have been getting a lot of interesting information on the technical topics like this one.        read more       
You need to log in before you can reply login | Register

Points Rule

Quick reply Top Return list