Login
Immutable PageDiscussionInfoAttachments

Please use a more selective search term instead of ""

Clear message
iz/Memo/UnixSeminar2013演習の回答

MMA

nomeaning/演習問題

fileの中身

cat ~nomeaning/Public/unix-seminar/file.txt

find the keyword

find ~nomeaning/Public/unix-seminar/k/ -type f -name '*keyword*'

grep the keyword

find ~nomeaning/Public/unix-seminar/k/ -type f | xargs grep Keyword

Kernel version

uname -r 

wc

grep a\\.out ~nomeaning/Public/unix-seminar/file2.txt | wc -l

md5sum

md5sum ~nomeaning/Public/unix-seminar/file.txt  

long file

head -12345321 ~nomeaning/Public/unix-seminar/lf.txt | tail -1

Send the signal

cp ~nomeaning/Public/unix-seminar/a.out a.out && ./a.out &

killall -SIGUSR1 a.out

Languages

for lang in c cc cpp rb py hs java
do
    echo $lang
    find ~nomeaning/Public/unix-seminar/langs/ -type f -name \*\.$lang | xargs cat | wc -l
done

↓szhideとmizunashiに撃墜されたコード

for lang in c cc cpp rb py hs java
do
    echo $lang
    find ~nomeaning/Public/unix-seminar/langs/ -type f -name \*\.$lang | xargs wc -l | tail -1
done

Active!

c=0
for mail in /ml/mma-active/article/2013_Apl/*.gz 
do
  if zgrep nomeaning $mail > /dev/null
  then
    c=`expr $c + 1`
  fi
done
echo $c

↓ytokuさんに撃墜されたコード

zgrep nomeaning /ml/mma-active/article/2013_Apl/*.gz | wc -l

Mailer

zcat /ml/mma-active/article/2012_*/*.gz | grep -E \^\(X-Mailer\|User-Agent\) | cut -d ' ' -f 2 | ruby -e 'hist = Hash.new(0); STDIN.read.split("\n").each{|mailer| hist[mailer] += 1}; hist.each {|k, v| puts "#{k} #{v}"}' | sort -rn -k2

"sort | uniq -c"で出現頻度とれたらしい(ytokuさんより)。Rubyいらなかった。

↓そういう方針でやってみた

zcat /ml/mma-active/article/2012_*/*.gz | grep -E \^\(X-Mailer\|User-Agent\) | cut -d ' ' -f 2 | sort | uniq -c | sort -rn