Showing posts with label Unix Tweets. Show all posts
Showing posts with label Unix Tweets. Show all posts

bash find the files in a given path

tree -fi --noreport /u01/abc/def >/u01/abc/physicalfiles.txt

-finds the files in the directory and dumps the path of each file as a line in the file physicalfiles.txt.

or

find /u01/abc/def -type f | sort -o "/u01/abc/physicalfiles.txt"

finds the files in the path /u01/abc/def and sorts the result and dumps the result in the file physicalfiles.txt

Bash Find and Replace in a String

The following command replaces existing white space with the character "_" in the variable $var1 and assigns it to the variable $var2.

$var2=$(echo "$var1" | sed 's/ /_/g');

Unix Send HTML Email

Using mail or mutt utilities we can send HTML emails from Unix console or bash scripts.
Following scriptlet sends a HTML content from mytest.html file:
 
mutt -e "my_hdr Content-Type: text/html" test@yahoo.com  -s "subject" < mytest.html
 
Thanks.