[K12OSN] Most Bash scripting questions? :)

Nils Breunese nils at breun.nl
Thu Dec 11 20:51:32 UTC 2008


Huck wrote:

> was more about stripping out...but either of those will work fine
> I can bastardize another script to rip 'em out...

Copy the lines with 'cd /home/' in .bash_history to a separate file:

	$ grep 'cd /home/' .bash_history > separate-file

Delete the lines with 'cd /home/' from .bash_history (the forward  
slashes in the path need to be escaped):

	$ sed -i -e '/cd \/home\//d' .bash_history

Note that the '>' overwrites the contents on any existing 'separate- 
file'. A new 'separate-file' is created if it doesn't exist yet. If  
you want to append instead of overwrite, use >> instead.

Nils Breunese.




More information about the K12OSN mailing list