Commit 85caaca9 authored by mouhamad.orabi's avatar mouhamad.orabi

add ex2 A set of commands for dealing with multiple files

parent 71244984
#2
######################a:
mkdir ~/newfile
#######################b&c
for n in {1..10}; do
for c in {a..z}; do
if [ "$c" = "x" ]; then
echo "Hello Linux" > ~/newfile/"file${n}_${c}"
else
touch ~/newfile/"file${n}_${c}"
fi
done
done
##or
##########################b:
for n in {1..10}; do
for c in {a..z}; do
touch ~/newfile/"file${n}_${c}"
done
done
#########################c:
find ~/newfile -name "*c" -exec sh -c 'echo "Hello Linux" > "$0"' {} \;
#########################d:
for n in {a..z}; do mkdir ~/newfile/"$n"; mv ~/newfile/file*"$n" "$n"/; done
#########################e:
find ~/newfile -name "file[3,4]*" -exec rm {} \;
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment