Text Processing Command

Use of wc

wc res #output: 31(line) 31(word) 84(character) res

Convert to one line

cat a | tr -d '\n' > oneline

Find Unique Line

cat filename | sort | uniq -c

Use of AWK

mmahmood@ubuntu:~$ echo 'Hello, my name is Mossaddeque Mahmood' | awk '{print $1 " " $5 " " $6}'
Hello, Mossaddeque Mahmood
mmahmood@ubuntu:~/Desktop$ awk '/exception/ { print $0 }' localhost.2012-02-29.log
SEVERE: Servlet.service() for servlet [spring] in context with path [/mpms] threw exception [Request processing failed; nested exception is java.lang.ClassCastException: java.util.LinkedHashSet cannot be cast to com.redmind.mpms.entity.PhysicianSpeciality] with root cause
Unless otherwise stated, the content of this page is licensed under Creative Commons Attribution-ShareAlike 3.0 License