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
Loop column output handband2 UNIX Desktop for Dummies Questions & Answers 1 11-03-2008 10:46 PM
Compare 2 files for a single column and output differences samit_9999 UNIX for Dummies Questions & Answers 1 04-23-2008 01:02 PM
Can we use 'tr' command to print 5th column of output of 'ls -l' Nidhi2177 Shell Programming and Scripting 4 09-17-2007 07:53 AM
Sub. numbers in column of output with If ja156194 Shell Programming and Scripting 11 02-12-2007 01:52 PM
flags to suppress column output, # of rows selected in db2 sql in UNIX jerardfjay Shell Programming and Scripting 1 11-02-2005 06:48 AM

 
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
Prev Previous Post   Next Post Next
  #1 (permalink)  
Old 11-04-2008
manmeet manmeet is offline
Registered User
  
 

Join Date: Sep 2008
Posts: 51
how to cut off last column from the output

I have a problem with my script. I am using following code
awk -F"," '{print $0,",",substr($2,3,3)}' $REG_InputFileName > $TargetSeqPath/Master.tmp

while read i
do
echo $i > $TargetSeqPath/Ref.tmp
OutFileName=`awk -F"," '{print $3}' $TargetSeqPath/Ref.tmp`
rm -f $TargetSeqPath/$OutFileName.dat
touch $TargetSeqPath/$OutFileName.dat
awk -F"," 'NR==FNR {col1[$1]=$3} NR!=FNR { if (col1[substr($2,3,3)]=="") {next} print $0}' $TargetSeqPath/Ref.tmp $TargetSeqPath/Master.tmp >> $TargetSeqPa
th/$OutFileName.dat
done < $RefInputFileName


In this script i am having output as following :

"UPDATE", "3000020113", "1-01-01", "THB" , 300
"UPDATE", "3000020307", "1-01-01", "THB" , 300
"UPDATE", "3000020409", "1-01-01", "USD" , 300
"UPDATE", "3000021126", "1-01-01", "USD" , 300

but i want to get rid of last column . Can anybody help me with this?

Thanks
 

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 08:47 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