Thursday, February 23, 2012

print all columns except last one

in awk:

print all columns except the first one column:
awk '{$1=""; print $0}' file

print all columns except the last one column:
awk '{$NF=""; print $0}' file

or acting as a geek, you can use the "rev" command to reverse the lines, then cut from the second field, then rev again:

rev file | cut -f2- | rev

Motivated from:http://lowfatlinux.com/linux-columns-cut.html#ixzz1nFIa9DZm


The unix command 'column' seems working for this purpose, but I did not figure it out yet. Here is column document:
http://www.eskimo.com/~scs/src/column.man.html

3 comments:

  1. Hello,
    It's time to work with new project and make more clients. Make photography business more effective by taking our editing service. In fact, if you are really serious about your financial success, you can deal with Clipping Path Adept. We will give you the best editing service within your budget and it's on time.

    ReplyDelete
  2. This blog is really helpful regarding all educational knowledge I earned. It covered a great area of subject which can assist a lot of needy people. Everything mentioned here is clear and very useful.
    โรงพิมพ์ราคาถูก

    ReplyDelete
  3. Fantastic post, very informative. I wonder why the other specialists of this sector do not notice this. You must continue your writing. I'm confident, you have a great readers' base already!
    โรงพิมพ์

    ReplyDelete