![]() |
|
|
google unix.com
|
|||||||
| Forums | Register | Forum Rules | Links | Albums | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
| 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 |
|
|
LinkBack | Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
||||
|
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 |
| Display Modes | Rate This Thread |
|
|