Advertisement
Guest User

george-ghiurutan

a guest
Jul 5th, 2015
166
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 0.80 KB | None | 0 0
  1. Explicatii
  2.  
  3. 1. wc - word count
  4.  
  5. Aplicatii
  6.  
  7. 1. Numara fiserele din directorul curent (recursiv)
  8.  
  9. find . -type f | wc -l
  10.  
  11. 2. Numara liniile pentru fiecare fisier din direct. curent
  12.  
  13. read p
  14. wc -l `find /path/to/directory/ -type f`
  15.  
  16. 3. Tipareste fisierele/directoarele (f/d)
  17.  
  18. find -type f
  19.  
  20. Other:
  21.  
  22. - each file/directory:
  23.  
  24. #!/bin/bash
  25.  
  26. for i in `find . -type f`
  27. do
  28.     echo $i
  29. done
  30.  
  31. - altul
  32.  
  33. #!/bin/bash
  34.  
  35. for i in `find /home/raresmardare/Desktop/exx -type f`
  36. do
  37.     awk '{print $0 }' $i
  38. done
  39.  
  40. - altul
  41.  
  42. print NF - numarul de cuvinte pe linie
  43. print $NF - ultimul cuvant din linie
  44.  
  45. - Average with AWK
  46.  
  47. awk '{ t += $1; n += 1; }
  48.  
  49. - display number per line
  50.  
  51. awk '{ t = 0; for (i = 1; i <= NF; ++i) t += 1; print t }'
  52.  
  53. - awk display number of lines
  54.  
  55. awk '{ t += 1 } END { print t }'
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement