[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: HOWTO remove a previous wildcard file list?



-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

On Sun, 22 Apr 2001, Mark Hurley wrote:

>
>Anyone know of a method to easily solve this ...
>
>I *sometimes* list the files before deleting them:
>
>	ls A*.pdf
>
>Ensuring I have only listed the ones I wish to delete, I then enter:
>
>	rm A*.pdf
>
>Great, but anyone know of an easier why than the following?
>
>1) Type the second command followed by the selected mask?
>2) Go back one in bash "history", [home] to beginning of line replace
>"ls" with "rm".

!!:s/ls/rm/

!! repeat previous command
s/ls/rm/ find "ls" in the pipe and replace it with "rm"

You can do this in any POSIX shell.

>I'm thinking something like the bash CTRL-R combo? Where you would
>type rm (second command) and do a key-combo and fill rest of previous
>line in, or to step it further you could keep scrolling back in
>history with uparrow-something combo?

Take a look at the manpage for bash for a bit more explanation, the tcsh
manpage for a better one (IMHO).  Basically, if you know the number of the
line in the history buffer, you can use !<number> to get to it.  !
notation can get pretty deep really quickly.  There's !-<number> (go back
in the history number entries), !<pattern> (find the last command in the
history buffer matching command).

>Thanks!
>
>Mark
>
>
>

- -- 
Be Careful! I have a black belt in sna-fu!

Who is John Galt?  galt@inconnu.isu.edu

-----BEGIN PGP SIGNATURE-----
Version: PGP for Personal Privacy 5.0
Charset: noconv

iQA/AwUBOuTLaR9mehuYcOjMEQKK4wCgqeBMwgkePrYDERFqCiHjjzL2pycAoJVe
eJDnS2g2VEjJq9ag8b1fnNAe
=pXRI
-----END PGP SIGNATURE-----



Reply to: