'Save history for a specific command elsewhere than .bash_history
By default, command history is stored in ~/.bash_history file.
I want to save the history for a specific command elsewhere than ~/.bash_history every time the command is called, like in a file ~/.specific-command-history.
I don't want to run grep to search for a specific command neither exclude it from ~/.bash_history, I just wanted to have a history for a specific command to be automatically stored in other file as well as in ~/.bash_history.
Any thoughts about that?
Solution 1:[1]
You could create and run an anacron script, even if at a set time the server was switched off, when the server is switched on, anacron will run the script.
The anacron script would grep the file with the command you are looking for, and then use cut, and then append the file you would like to paste the lines into.
Solution 2:[2]
_ and % have no significance in REPLACE. These are only used by LIKE and PATINDEX.
Use an accent insensitive COLLATE clause (AI) to have o and ó treated interchangeably
SELECT
REPLACE (REPLACE ( Dcpt.[desc] COLLATE Latin1_General_100_CS_AI, N'Compañía', N'Compañía /'), N'Producción', N' Producción /' )
FROM Dcpt
Change CS to CI if you also want case insensitivity.
Solution 3:[3]
Try Follow:
SELECT
REPLACE (REPLACE ( Dcpt.[desc], N'Compañía', N'Compañía /'), N'Producción', N' Producción /' )
FROM Dcpt
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | |
| Solution 2 | Martin Smith |
| Solution 3 | AliNajafZadeh |
