looping through files to search for given substrings
#!/bin/bash
dir="/home/ubuntu/data" # loop though all the required dates for ldate in $(echo 2012{01,02,03,04,05,06,07,08,09,10,11,12}{01,11,21}) do # for each date # check if there is a file in input directory which contains the date file=$(ls ${dir}/ | grep ${ldate}) if [[ -n ${file} ]]; then # file was found name=${file##*/} fdate=${name:11:8} size=$(stat -c %s ${dir}/${name}) echo "date=${ldate}, name=${name}, size=(${size} bytes)" else # file was not found echo "date=${ldate}, no file matching" fi done Bash is fun.................... just made this scripts, it searches part of filenames for a date given, which is a substring for a file name,if the date macthes part of the file name it prints out else it print that date given as a substring does not macth.make your edits towards your scripts.bashhhhhhhhhhhhh!!!! |
Look what I find on web. It is about making keyboard caps led flashing when hdd is in use. Didn't try it personally, but i'm amazed by the power of shell scripts.
Code:
#!/bin/bash |
All times are GMT -5. The time now is 04:54 PM. |