Common Examples of Using gsed on FreeBSD
Options and parameters:
-n : Use silent mode. In general gsed usage, all data from STDIN will generally be listed on the screen. But if the -n parameter is added, only the line (or action) that has been specially processed by gsed will be listed.
-e command : Edit gsed actions directly in the command line mode.
-f command_file : Write the gsed action directly in a file, -f command_file can execute the gsed action in command_file.
-i : Modify the content of the read file directly instead of outputting it on the screen.
- -r : The action of gsed supports the grammar of extended formal expressions. (The default is basic regular expressions grammar).
a : Addition. After "a" can be followed by strings, and these strings will appear on a new line (the current next line).
c : Replace. "c" can be followed by strings, and these strings can replace the lines between n1 and n2!
d : Delete.
i : Insert. Strings can be followed by "i", and these strings will appear on a new line (the current previous line).
- p : Print. That is, a certain selected data will be printed out. Usually "p" will run with the parameter gsed -n .
s : Substitute. You can directly work on this example! The usual actions can be matched with regular expressions! For example, 1,20s/old/new/g is it!
Comments
Post a Comment