标签:ant pattern add solution cas red int useful -name
There will be some case-based tips for Shell.
Input example
a b c d
Output example
a
b
c
d
sed
is the best solution.
sed -r -e ‘s/[[:space:]]/\n/g‘
It is very useful when counting word frequency.
sort | uniq -c | sort -rn
This command actually clear the first column from the file.
awk ‘{$1=""; print $0}‘
Taking advantage of the const length
in awk
awk ‘{print $0" "length}‘ | sort -k2 -nr | head -1
Using
grep -v
Using for
to loop over the file and sed
to perform the replacement.
for f in `find ./src -type f`; do sed -i ‘s/oldnamespace/newnamespace‘ $f; done
Perl
can be a better solution.
perl -e ‘for{$i=2;$i<=24;$i++}{printf("%02d\n", $i)}‘
awk ‘{print 1/10}‘
and additional enter is needed
More flexiable (with formatting).
perl -e ‘printf("%f\n", 1./10);‘
标签:ant pattern add solution cas red int useful -name
原文地址:http://www.cnblogs.com/stevendes1/p/7221112.html