The UNIX and Linux Forums  

Go Back   The UNIX and Linux Forums > Top Forums > Shell Programming and Scripting
.
google unix.com



Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts and shell scripting languages here.

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
Delete a row that has a duplicate column spartan22 Shell Programming and Scripting 5 05-30-2009 05:13 AM
Delete first column in tab-delimited text-file andmal Shell Programming and Scripting 2 03-13-2009 06:42 AM
to delete a column in unix gaddesuneetha UNIX for Dummies Questions & Answers 8 12-12-2006 06:48 PM
delete 7th column in unix pavan_test UNIX for Dummies Questions & Answers 6 12-20-2005 03:17 AM
Search for by column and delete line thudak Shell Programming and Scripting 4 04-24-2002 10:13 AM

Reply
English Japanese Spanish French German Portuguese Italian Dutch Swedish Russian Norwegian Hungarian Hebrew Danish Bulgarian Greek Powered by Powered by Google
 
LinkBack Thread Tools Search this Thread Rate Thread Display Modes
  #1 (permalink)  
Old 08-21-2009
susau_79 susau_79 is offline
Registered User
  
 

Join Date: Jul 2009
Posts: 20
Delete first row last column

Hi All,
I am having following file and I want to delete 1 row last column.

Current File Content:
================
procedure test421 put_line
procedure test321 test421
procedure test521 test321
procedure test621 test521


Expected File Content:
===========================
procedure test421
procedure test321 test421
procedure test521 test321
procedure test621 test521

With best wishes,
-Saurabh
  #2 (permalink)  
Old 08-21-2009
ranjithpr ranjithpr is offline
Registered User
  
 

Join Date: Nov 2007
Posts: 157
Try this,


Code:
awk 'NR==1 {$NF=""}1' file

Regards,

Ranjith
  #3 (permalink)  
Old 08-22-2009
skmdu skmdu is offline
Registered User
  
 

Join Date: Jul 2009
Posts: 125
solution for delete last column in first row

Hope this works,

$cat data
procedure test421 put_line
procedure test321 test421
procedure test521 test321
procedure test621 test521

$sed "1s/\(.* \)\([a-zA-Z0-9_]*\)$/\1/g" data
procedure test421
procedure test321 test421
procedure test521 test321
procedure test621 test521
  #4 (permalink)  
Old 08-22-2009
durden_tyler's Avatar
durden_tyler durden_tyler is offline Forum Advisor  
Registered User
  
 

Join Date: Apr 2009
Posts: 553

Code:
perl -lne '@x=split; $x[$#x]="" if $.==1; print "@x"' file

tyler_durden
Reply

Bookmarks

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On




All times are GMT -4. The time now is 06:22 AM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited. Language Translations Powered by .
vBCredits v1.4 Copyright ©2007 - 2008, PixelFX Studios
The UNIX and Linux Forums Content Copyright ©1993-2009. All Rights Reserved.Ad Management by RedTyger

Content Relevant URLs by vBSEO 3.2.0