sed

SED – stream editor for filtering and transforming text

# remove all leading whitespace from line including tabs

# sed -e 's/^[ \t]*//' < inputfile

# regex example – how to find needle in a haystack

# echo "/foo/bar/filename.161212.needle-in-a-haystack.lost-forever" | /bin/sed -r 's/^.+\/filename.[0-9]{6}\.(.+?)\.lost-forever/\1/'
needle-in-a-haystack

 

If you found this useful, say thanks, click on some banners or donate, I can always use some beer money.