Browse Source

Init

master
blallo 1 year ago
commit
beee2bf6f8
14 changed files with 75 additions and 0 deletions
  1. +4
    -0
      01-copy_files/01.sh
  2. +4
    -0
      01-copy_files/02.sh
  3. +3
    -0
      02-create_dirs/01.sh
  4. +3
    -0
      02-create_dirs/02.sh
  5. +14
    -0
      02-create_dirs/03.sh
  6. +4
    -0
      03-mv_files/01.sh
  7. +10
    -0
      03-mv_files/02.sh
  8. +3
    -0
      04-search_files/01.sh
  9. +4
    -0
      04-search_files/02.sh
  10. +3
    -0
      04-search_files/03.sh
  11. +3
    -0
      05-search_text/01.sh
  12. +3
    -0
      05-search_text/02.sh
  13. +7
    -0
      05-search_text/03.sh
  14. +10
    -0
      06-replace_text/01.sh

+ 4
- 0
01-copy_files/01.sh View File

@@ -0,0 +1,4 @@
#!/usr/bin/env bash

touch pippo.txt
ls -l pippo.txt

+ 4
- 0
01-copy_files/02.sh View File

@@ -0,0 +1,4 @@
#!/usr/bin/env bash

cp pippo.txt pluto.prova
ls -l pluto.prova

+ 3
- 0
02-create_dirs/01.sh View File

@@ -0,0 +1,3 @@
#!/usr/bin/env bash

mkdir scatolone

+ 3
- 0
02-create_dirs/02.sh View File

@@ -0,0 +1,3 @@
#!/usr/bin/env bash

chmod a-rw scatolone

+ 14
- 0
02-create_dirs/03.sh View File

@@ -0,0 +1,14 @@
#!/usr/bin/env bash


START=$(date --date="20190101" +%s)
LEN=$(date +%j)


for INTDATE in $(seq $LEN)
do
DELTA=$(( INTDATE*86400 ))
TIME=$(( START+DELTA ))
DATE=$(date --date="@${TIME}" +%Y%m%d)
mkdir $DATE
done

+ 4
- 0
03-mv_files/01.sh View File

@@ -0,0 +1,4 @@
#!/usr/bin/env bash

mkdir Archivio
mv ../02-create_dirs/2019* Archivio

+ 10
- 0
03-mv_files/02.sh View File

@@ -0,0 +1,10 @@
#!/usr/bin/env bash

cd Archivio
mkdir {Mon,Tue,Wed,Thu,Fri,Sat,Sun}

for FOLDER in $(ls -1 2019*)
do
DAY=$(date --date=${FOLDER%:} +%a)
mv ${FOLDER%:} $DAY
done

+ 3
- 0
04-search_files/01.sh View File

@@ -0,0 +1,3 @@
#!/usr/bin/env bash

find / -name passwd

+ 4
- 0
04-search_files/02.sh View File

@@ -0,0 +1,4 @@
#!/usr/bin/env bash

find / -ctime -7
find / -mtime -7

+ 3
- 0
04-search_files/03.sh View File

@@ -0,0 +1,3 @@
#!/usr/bin/env bash

find / -name "conf*" -type d

+ 3
- 0
05-search_text/01.sh View File

@@ -0,0 +1,3 @@
#!/usr/bin/env bash

curl http://world.std.com/~wij/dante/paradiso.txt -s|grep -i beatrice

+ 3
- 0
05-search_text/02.sh View File

@@ -0,0 +1,3 @@
#!/usr/bin/env bash

curl http://world.std.com/~wij/dante/inferno.txt -s|grep "[0-9]"

+ 7
- 0
05-search_text/03.sh View File

@@ -0,0 +1,7 @@
#!/usr/bin/env bash

wget http://world.std.com/~wij/dante/inferno.txt
wget http://world.std.com/~wij/dante/purgatorio.txt
wget http://world.std.com/~wij/dante/paradiso.txt

grep -i -r "\(virgilio\|beatrice\|dio\)"

+ 10
- 0
06-replace_text/01.sh View File

@@ -0,0 +1,10 @@
#!/usr/env/bin bash

cp ../05-search_text/*txt .

for TEXT in *txt
do
sed -i"" "s/Virgilio/PLACEHOLDER/g" $TEXT
sed -i"" "s/Beatrice/Virgilio/g" $TEXT
sed -i"" "s/PLACEHOLDER/Beatrice/g" $TEXT
done

Loading…
Cancel
Save