#!/bin/bash
for f in *.{jpg,png,webm,mp4}; do mv "$f" "$(sed 's/[^0-9A-Za-z_.]/_/g' <<< "$f>; done
Currently using this script to turn all of the specified files of that extension and strip their special characters, but I'm wondering if it's possible to then pipe that and filter the useless output (namely the warning that a file was skipped due to already having no special characters).
I know I can use > /dev/null 2>&1
to throw everything away, but is it possible to filter only certain output which matches a pattern/keyword and then remove only those lines from output? Or, inversely, only filter lines which match a pattern/string.