The UNIX and Linux Forums  
Hello and Welcome from United States to the UNIX and Linux Forums! Thank You for Visiting and Joining Our Global Community.

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
Remove whitespaces between comma separated fields from file nitinbjoshi UNIX for Dummies Questions & Answers 2 06-14-2008 09:14 AM
Parse a string in XML file using shell script ayhanne Shell Programming and Scripting 46 01-09-2008 12:33 PM
search for the contents in many file and print that file using shell script cdfd123 Shell Programming and Scripting 3 10-07-2007 11:17 PM
How to parse config variables from external file to shell script pradsh Shell Programming and Scripting 2 07-09-2007 03:21 PM
Splitting comma separated values into an array tmarikle Shell Programming and Scripting 3 06-24-2005 06:50 PM

 
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 06-18-2008
KrishnaSaran KrishnaSaran is offline
Registered User
  
 

Join Date: Jun 2008
Posts: 12
Unix shell script to parse the contents of comma-separated file

Dear All,

I have a comma-separated file.
1. The first line of the file(header) should have 4 commas(5 fields).
2. The last line of the file should have 1 comma(2 fields).

Pls help me in checking this condition in a shell script.

And the number of lines between the first line and last line of the file, should match with the last field of the first and last line.

That is, the last field of first and last line wil have a number, that should match with {number of line in the file} -2.

Pls help me out with this.


Example file: QDB_2008.txt

1.1,20070427151500,99567,99669,0009
00001,20070427,00567,6012345671,2081,I
00002,20070427,00568,6012345672,2054,I
00003,20070427,00569,6012345673,2063,I
00004,20070427,00570,6012345674,2081,D
00005,20070427,00571,6012345675,2054,D
00006,20070427,00572,6012345676,2063,D
00007,20070427,00573,6012345677,2081,U
00008,20070427,00574,6012345678,2054,U
00009,20070427,00575,6012345679,2063,U
101.1.0,0009#

Regards,
Krishna
 

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 11:24 PM.


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