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

9 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
  4. Its a great pleasure reading your post.Its full of information I am looking for and I love to post a comment that "The content of your post is awesome" Great work. look at here

    ReplyDelete


  5. That is very interesting; you are a very skilled blogger. I have shared your website in my social networks! A very nice guide. I will definitely follow these tips. Thank you for sharing such detailed article.

    Ms excel training in chennai

    ReplyDelete
  6. Sometime it becomes very hard to find a well written and well established bog which give you correct and useful information. However, I found this blog and got some relevant information which are really helpful for me.
    ป้ายสินค้า

    ReplyDelete
  7. Very knowledgeable post thank you for sharing Python Online Training Bangalore

    ReplyDelete
  8. Personally I think overjoyed I discovered the blogs.
    National Junk Food Day

    ReplyDelete