Editing a previous command line

You can edit any previous command from the history list to create a new command. Suppose that command number 23 in the history list is:

   23 lpr part[1-4].ps

To change [1-4] to [5-8] use the command:

   !23:s/[1-4]/[5-8]/

This will now run the command:

   lpr part[5-8].ps

[Home] [Search] [Index] This site maintained by webmaster@unixpower.org