A neat feature of Cisco IOS and IOS-XE is the ability to enable Linux shell functions and commands. This works on both IOS and IOS-XE (which is Linux underneath anyways). To enable shell processing globally, login to your Cisco router or switch and then run the below command from config mode:
Switch(config)#shell processing full
If for any reason you wanted to enable shell processing for just the current terminal session – this can be done from enable mode like so:
Switch(config)#terminal shell
Great! Shell processing is now enabled, don’t forget to write your config. Now here comes to cool part, you can use standard Linux functions on your CLI commands with pipe:
Switch#show ip route | nl | grep 14
14: S* 0.0.0.0/0 [0/0] via 10.0.0.1

So with this command we piped in the function nl (new line) and grep (pattern match) with line 14 as the match. The output is the gateway of last resort on the switch – line 14 of the show ip route command. Neat!
To see what functions are available run the following command:
Switch#show shell functions
All the standard Linux bash items are available, you can also run the man command like so:
Switch#man grep
Which gives you the CLI switches that each shell function supports.
A favorite of mine when working with layer 2 switches, to see what IP Addresses are assigned (SVI etc):
Switch#show ip int brief | grep -v unassigned
Interface IP-Address OK? Method Status Protocol
Vlan1 10.0.0.2 YES NVRAM up up

Using the invert switch -v for grep, match all lines that do not have unassigned them. 🙂
More information is located at the Cisco website here.