Just another update
This commit is contained in:
parent
a25938f123
commit
00a190b0a6
6591 changed files with 94363 additions and 23227 deletions
17
Task/File-size/AWK/file-size.awk
Normal file
17
Task/File-size/AWK/file-size.awk
Normal file
|
|
@ -0,0 +1,17 @@
|
|||
# usage: awk -f filesize.awk -v fn=input.txt
|
||||
|
||||
BEGIN { # Filesize on Unix, using ls
|
||||
#system("ls -l")
|
||||
|
||||
if(!fn) fn ="input.txt"
|
||||
cmd="ls -l " fn
|
||||
print "#", cmd
|
||||
system(cmd)
|
||||
|
||||
cmd | getline x
|
||||
close(cmd)
|
||||
#print x
|
||||
n=split(x,stat," ")
|
||||
#for (i in stat) {print i, stat[i] }
|
||||
print "file:", stat[9], "size:", stat[5]
|
||||
}
|
||||
1
Task/File-size/Lua/file-size-1.lua
Normal file
1
Task/File-size/Lua/file-size-1.lua
Normal file
|
|
@ -0,0 +1 @@
|
|||
FileTools:-Size( "input.txt" )
|
||||
1
Task/File-size/Lua/file-size-2.lua
Normal file
1
Task/File-size/Lua/file-size-2.lua
Normal file
|
|
@ -0,0 +1 @@
|
|||
FileTools:-Size( "/input.txt" )
|
||||
|
|
@ -1,9 +0,0 @@
|
|||
function GetFileSize( filename )
|
||||
local fp = io.open( filename )
|
||||
if fp == nil then
|
||||
return nil
|
||||
end
|
||||
local filesize = fp:seek( "end" )
|
||||
fp:close()
|
||||
return filesize
|
||||
end
|
||||
2
Task/File-size/NewLISP/file-size.newlisp
Normal file
2
Task/File-size/NewLISP/file-size.newlisp
Normal file
|
|
@ -0,0 +1,2 @@
|
|||
(println (first (file-info "input.txt")))
|
||||
(println (first (file-info "/input.txt")))
|
||||
8
Task/File-size/Scala/file-size.scala
Normal file
8
Task/File-size/Scala/file-size.scala
Normal file
|
|
@ -0,0 +1,8 @@
|
|||
import java.io.File
|
||||
|
||||
object FileSize extends App {
|
||||
val name = "pg1661.txt"
|
||||
|
||||
println(s"$name : ${new File(name).length()} bytes")
|
||||
println(s"/$name : ${new File(s"${File.separator}$name").length()} bytes")
|
||||
}
|
||||
|
|
@ -1,2 +1,10 @@
|
|||
size1=$(wc -c < input.txt | tr -d ' ')
|
||||
size2=$(wc -c < /input.txt | tr -d ' ')
|
||||
echo "# ls:"
|
||||
ls -la input.txt
|
||||
|
||||
echo "# stat:"
|
||||
stat input.txt
|
||||
|
||||
echo "# Size:"
|
||||
size1=$(ls -l input.txt | tr -s ' ' | cut -d ' ' -f 5)
|
||||
size2=$(wc -c < input.txt | tr -d ' ')
|
||||
echo $size1, $size2
|
||||
|
|
|
|||
|
|
@ -1,2 +1,2 @@
|
|||
size1=$(stat -f %z input.txt)
|
||||
size2=$(stat -f %z /input.txt)
|
||||
size1=$(wc -c < input.txt | tr -d ' ')
|
||||
size2=$(wc -c < /input.txt | tr -d ' ')
|
||||
|
|
|
|||
|
|
@ -1,5 +1,2 @@
|
|||
# from module 'zsh/stat', load builtin 'zstat'
|
||||
zmodload -F zsh/stat b:zstat
|
||||
|
||||
size1=$(zstat +size input.txt)
|
||||
size2=$(zstat +size /input.txt)
|
||||
size1=$(stat -f %z input.txt)
|
||||
size2=$(stat -f %z /input.txt)
|
||||
|
|
|
|||
5
Task/File-size/UNIX-Shell/file-size-5.sh
Normal file
5
Task/File-size/UNIX-Shell/file-size-5.sh
Normal file
|
|
@ -0,0 +1,5 @@
|
|||
# from module 'zsh/stat', load builtin 'zstat'
|
||||
zmodload -F zsh/stat b:zstat
|
||||
|
||||
size1=$(zstat +size input.txt)
|
||||
size2=$(zstat +size /input.txt)
|
||||
Loading…
Add table
Add a link
Reference in a new issue