How do I match a string ending with certain characters using grep?
-
Note: Be careful with the I/O redirection characters
<
and>
always ensure important files can be easily retrieved from backups.Example textfile used.
$ cat textfile If the boots fits boots bootss bloom beautiful
We want to match the strings ends with
fit
, in this case it is the word fit.$ grep "fit\>" textfile If the boots fit
© Lightnetics 2024