cli-sedHow can I view my command line sed history?
The command line history of sed can be viewed by using the sed -n -e 'H;${x;s/\n/ /g;s/^,*//;s/,*$//;p;}' ~/.bash_history | sed -e 's/^[ \t]*//'
command. This command prints the entire command line history of sed, including all the commands, options, and arguments used.
For example, to view the command line history of sed from the last 7 days, the following command can be used:
sed -n -e 'H;${x;s/\n/ /g;s/^,*//;s/,*$//;p;}' ~/.bash_history | sed -e 's/^[ \t]*//' | grep -E "^sed .* [0-9]{4}-[0-9]{2}-[0-9]{2}"
The command is composed of several parts:
sed -n -e 'H;${x;s/\n/ /g;s/^,*//;s/,*$//;p;}' ~/.bash_history
– This part of the command prints the entire command line history of sed, including all the commands, options, and arguments used.sed -e 's/^[ \t]*//'
– This part of the command removes any leading whitespace.grep -E "^sed .* [0-9]{4}-[0-9]{2}-[0-9]{2}"
– This part of the command filters the command line history of sed to only display commands from the last 7 days.
Helpful links
More of Cli Sed
- How can I use the command line to compress and edit files with sed and zip?
- How do I use the CLI to configure Zabbix?
- How do I use the command line to compress a file using SED and ZIP?
- How can I grant permission to use the CLI sed command?
- How can I use sed in the command line on macOS?
- How can I use CLI sed and Yarn together to develop software?
- How can I use SED in a Windows command line interface?
- How can I use sed to manipulate a JSON file from the command line?
- How do I use CLI sed to uninstall a module?
- How can I use sed in a command line interface?
See more codes...