How do I get the first column in Unix?

Danh Trịnh

New member
How do I get the first column in Unix?
Answer
Just put both column references next to each other.
  1. cat logfile | sed ‘s/|/ /’ | awk ‘{print $1, $8}’
  2. sed ‘s/|/ /’ logfile | awk ‘{print $1, $8}’
  3. awk -F ‘|’ ‘{print $1, $8}’ logfile.
  4. awk -F ‘|’ ‘{print $1, $NF}’ logfile.
 

Tìm kiếm

Back
Top