Friday, August 11, 2023

wget usage

To download multiple files from  web ;

 wget -r -nd --no-parent "http://foo.com" -A "*.jpg"


Friday, August 4, 2023

Print a character while command is executing in Linux

function printChar

{

    local pid=$!

    local delay=0.50

    local spinstr='...'

    echo "Loading "

    while [ "$(ps a | awk '{print $1}' | grep $pid)" ]; do

        local temp=${spinstr#?}

        printf "%s  " "$spinstr"

        local spinstr=$temp${spinstr%"$temp"}

        sleep $delay

        printf "\b\b\b"

    done

    printf "    \b\b\b\b"

echo

}

####

sqlplus -S $ouser/$opass@$oserver @$tmpPth/qry.sql & printChar



Thursday, February 2, 2023

Deleting crlf and concat lines in Linux

 for dosya in 2023*/*.tem ; do echo $dosya ; cat $dosya|sed ':a;N;$!ba;s/\n//g' >> test ; done

Wednesday, February 1, 2023

Finding files that consist empty lines and concat

grep  -l ^$ filename | xargs -i cp {} tmp1/        # find files if file consist empty line(s)

for fname in tmp1/aero* ; do echo $fname ; purefile=`echo $fname|awk -F "/" '{print $2}'`; cat $fname |awk '{print}' ORS=' ' > tmp2/$purefile ; done        # deletes empty line and copies to another directory