Agree with you James, I constantly push the results of one command to another, and sometimes to inline perl commands.
I'll harvest out the items from some list, and then build an array and pipe it as such:
[some command harvesting out in items in bash] | perl -ne 'print;chomp;system("bash commands go here")'
(see script I made at https://access.redhat.com/discussions/3487481 for more)
Another thing I've found recently is to build "shortcut conditional commands", such as this bit which sets a value using && for pass or || for conditional 'fail':
[ -d /sys/firmware/efi ] && fw="UEFI" || fw="BIOS"
echo -e "$fw"
if [ "$fw" == "UEFI" ] ; then
echo -e "\n\tUEFI detected, this is a ($fw) system.\n\setting \$fw variable to ($fw)..."
echo -e "\n\t($fw) system detected, proceeding...\n"
There's some other sed methods I hadn't seen that I borrowed from Ryan Sawhill such as:
rpm -q prelink >/dev/null && sed -i '/^PRELINKING/s,yes,no,' /etc/sysconfig/prelink
This will onlly flip the value of "PRELINKING' from yes to no if the rpm prelink exists. The use of sed here is a bit lesser known. (hat tip Red Hatter Ryan Sawhill for that one)
Personally i use egrep a lot when search for multiple pattern in a source. lsof and ps are also tools i use every day
My favorite would be Ctrl+R to do a "reverse-i-search"
Type a letter - like s - and you'll get a match for the most recent command in your history starting with s
Very usefull when I am busy troubleshooting.
Lightweight tool = cut
Heavyweight tool = awk
When used in pipes these two tools can extract the data that I need from the output of another command. awk is a full-blown C-like interpreter.