Sponsored Content
Top Forums Shell Programming and Scripting Last column is getting deleted Post 302453973 by scripter12 on Friday 17th of September 2010 01:50:16 AM
Old 09-17-2010
Last column is getting deleted

Hi,
I am having a problem in the below code:-.

Code:
$ cat x.csv
baseball,NULL,8798765,Most played,0,5,12367,NULL,NULL,98,67,Reason is not sufficient
baseball,NULL,8928192,Most played,0,4,76893,NULL,RAW,54,78,Reason is not sufficient
baseball,NULL,5678945,Most played,9,2,1,6,NULL,6789,123,Reason not conclueded
cricket,NOTNULL,125782,Usually played,NULL,NULL,NULL,NULL,123,67,Reason not conclueded
cricket,NOTNULL,678921,Usually played,NULL,NULL,NULL,NULL,563,NULL,Reason not defines


Expected output
===============
baseball,NULL,8798765,Most played,0,5,12367,NULL,NULL,98,67,Reason is not sufficient
        ,NULL,8928192,Most played,0,4,76893,NULL,RAW,54,78,Reason is not sufficient
        ,NULL,5678945,Most played,9,2,1,6,NULL,6789,123,Reason not conclueded
cricket,NOTNULL,125782,Usually played,NULL,NULL,NULL,NULL,123,67,Reason not conclueded
       ,NOTNULL,678921,Usually played,NULL,NULL,NULL,NULL,563,NULL,Reason not defines

but the output that is displayed is :-

$ nawk 'BEGIN{FS=","}!a[$1] {print;a[$1]++;next}{print FS$2FS$3FS$4FS$5FS$6FS$7FS$8FS$9FS$10FS$11FS12}' x.csv
baseball,NULL,8798765,Most played,0,5,12367,NULL,NULL,98,67,Reason is not sufficient
,NULL,8928192,Most played,0,4,76893,NULL,RAW,54,78
,NULL,5678945,Most played,9,2,1,6,NULL,6789,123
cricket,NOTNULL,125782,Usually played,NULL,NULL,NULL,NULL,123,67,Reason not conclueded
,NOTNULL,678921,Usually played,NULL,NULL,NULL,NULL,563,NULL,Reason not defines


The last column in row 2 and rown3 is getting deleted

Please somebody help me
 

9 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

deleted /usr

I accidentally deleted the usr on/. How can I start the server again? (5 Replies)
Discussion started by: rahmantanko
5 Replies

2. Shell Programming and Scripting

Changing one column of delimited file column to fixed width column

Hi, Iam new to unix. I have one input file . Input file : ID1~Name1~Place1 ID2~Name2~Place2 ID3~Name3~Place3 I need output such that only first column should change to fixed width column of 15 characters of length. Output File: ID1<<12 spaces>>Name1~Place1 ID2<<12... (5 Replies)
Discussion started by: manneni prakash
5 Replies

3. Shell Programming and Scripting

Who deleted crontab?

We are using SunOS 5.10 and Korn Shell. If we need to figure out who deleted our crontab file for a particular user what do we do. Thanks in Advance!! ---------- Post updated at 08:08 AM ---------- Previous update was at 07:19 AM ---------- Friends, Please help.... (5 Replies)
Discussion started by: mehimadri
5 Replies

4. UNIX for Advanced & Expert Users

deleted all files - rm *

Hi All, I am using Fedora Core and Windows Xp. I deleted all the files from root directory. When i am trying to restart the computer it showing some grub > prompt. What i will do ? I have lots of data in XP OS. Please help me i used # rm * (8 Replies)
Discussion started by: pritish.sas
8 Replies

5. Shell Programming and Scripting

Match column 3 in file1 to column 1 in file 2 and replace with column 2 from file2

Match column 3 in file1 to column 1 in file 2 and replace with column 2 from file2 file 1 sample SNDK 80004C101 AT XLNX 983919101 BB NETL 64118B100 BS AMD 007903107 CC KLAC 482480100 DC TER 880770102 KATS ATHR 04743P108 KATS... (7 Replies)
Discussion started by: rydz00
7 Replies

6. Emergency UNIX and Linux Support

Directory got deleted

One of my directory code where i have stored all my scripts have disappeared . I have no idea on how it got deleted.Could someone pls help me to track-back on what would have happened? I left the office yesterday and today when i just logged in to work with the scripts I could not find the... (13 Replies)
Discussion started by: michaelrozar17
13 Replies

7. Post Here to Contact Site Administrators and Moderators

how do i get my threads deleted?

as subject - need this done asap, in trouble (1 Reply)
Discussion started by: llcooljatt
1 Replies

8. Shell Programming and Scripting

Difference of the same column when two other column matches and one column differs less than 1 hour

This is my input file : # cat list 20130430121600, cucm, location,76,2 20130430121600,cucm1,location1,76,4 20130430122000,cucm,location,80,8 20130430122000,cucm1,location1,90,8 20130430140000,cucm1,location1,87,11 20130430140000, cucm,location,67,9 This is the required output ... (1 Reply)
Discussion started by: Lakshmikumari
1 Replies

9. Shell Programming and Scripting

awk Print New Column For Every Two Lines and Match On Multiple Column Values to print another column

Hi, My input files is like this axis1 0 1 10 axis2 0 1 5 axis1 1 2 -4 axis2 2 3 -3 axis1 3 4 5 axis2 3 4 -1 axis1 4 5 -6 axis2 4 5 1 Now, these are my following tasks 1. Print a first column for every two rows that has the same value followed by a string. 2. Match on the... (3 Replies)
Discussion started by: jacobs.smith
3 Replies
XmManager(3)							  LessTif Manuals						      XmManager(3)

NAME
XmManager - Motif-compatible window-manager widget SYNOPSIS
#include <Xm/Manager.h> XmManager XmCreateManager DESCRIPTION
XmManager X RESOURCES
Name Class Type Default Access ----------------------------------------------------------------------------------------- XmNunitType XmCUnitType UnitType NULL CSG XmNx XmCPosition HorizontalPosition NULL CSG XmNy XmCPosition VerticalPosition NULL CSG XmNwidth XmCDimension HorizontalDimension NULL CSG XmNheight XmCDimension VerticalDimension NULL CSG XmNborderWidth XmCBorderWidth HorizontalDimension NULL CSG XmNforeground XmCForeground Pixel NULL CSG XmNbackground XmCBackground Pixel NULL CSG XmNbackgroundPixmap XmCPixmap XmBackgroundPixmap NULL CSG XmNhighlightColor XmCHighlightColor Pixel NULL CSG XmNhighlightPixmap XmCHighlightPixmap ManHighlightPixmap NULL CSG XmNnavigationType XmCNavigationType NavigationType NULL CSG XmNshadowThickness XmCShadowThickness HorizontalDimension NULL CSG XmNtopShadowColor XmCTopShadowColor Pixel NULL CSG XmNtopShadowPixmap XmCTopShadowPixmap ManTopShadowPixmap NULL CSG XmNbottomShadowColor XmCBottomShadowColor Pixel NULL CSG XmNbottomShadowPixmap XmCBottomShadowPixmap ManBottomShadowPixmap NULL CSG XmNhelpCallback XmCCallback Callback NULL CSG XmNuserData XmCUserData Pointer NULL CSG XmNtraversalOn XmCTraversalOn Boolean NULL CSG XmNstringDirection XmCStringDirection StringDirection NULL CSG XmNinitialFocus XmCInitialFocus Widget NULL CSG XmNunitType XmNx XmNy XmNwidth XmNheight XmNborderWidth XmNforeground XmNbackground XmNbackgroundPixmap XmNhighlightColor XmNhighlightPixmap XmNnavigationType XmNshadowThickness XmNtopShadowColor XmNtopShadowPixmap XmNbottomShadowColor XmNbottomShadowPixmap XmNhelpCallback XmNuserData XmNtraversalOn XmNstringDirection XmNinitialFocus CLASS HIERARCHY
Object(3) Rect(3) UnNamedObj(3) Core(3) Composite(3) Constraint(3) XmManager(3) CALLBACKS
CONVENIENCE FUNCTIONS
SEE ALSO
LessTif Project April 1998 XmManager(3)
All times are GMT -4. The time now is 04:24 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy