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
change order of fields in header record JohnMario UNIX for Dummies Questions & Answers 1 05-22-2008 02:58 PM
How count number of fields in a record sureshg_sampat Shell Programming and Scripting 5 01-07-2008 06:30 AM
splitting a record and adding a record to a file rsolap Shell Programming and Scripting 1 08-13-2007 01:58 PM
awk: record has too many fields chaandana Shell Programming and Scripting 3 07-29-2005 01:03 PM
How to screen each variable record for right # of fields jvander Shell Programming and Scripting 3 04-27-2005 10:55 AM

Closed Thread
English Japanese Spanish French German Portuguese Italian Dutch Swedish Russian Norwegian Hungarian Hebrew Danish Powered by Powered by Google
 
LinkBack Thread Tools Search this Thread Rate Thread Display Modes
  #1 (permalink)  
Old 12-07-2005
rinku11 rinku11 is offline
Registered User
  
 

Join Date: Dec 2005
Posts: 20
Manipulating fields record wise

Hi all,
I have an input file with no delimiter. Let us say the file is abc.txt having values for fields namely, EmpNumEnameDesigSalDept. Ofcourse the file has got several records. Every field has got a fixed start and end position.
I need to assign the fields to corresponding varibles say EmpNum, Ename, Desig, Sal and Dept. Now if Dept is more than 10 and less than 15, then I have to give the 20% increment in Salary, or if Dept is more than 15, then I have to give the 30% increment in Salary. Again, for a particular Dept I need to check if the Designation is Manger. Once a record meets the above condtions, I need to pick the fields for that record and put them all (or selective fields only) in a separate file. Then I will move to the next record and so on.
Thanks in advance for resolving the issue.
Regards,
Rin..
  #2 (permalink)  
Old 12-07-2005
blowtorch's Avatar
blowtorch blowtorch is offline Forum Advisor  
Supporter
  
 

Join Date: Dec 2004
Location: Singapore
Posts: 2,350
Sounds suspisciously like homework... if so, you are violating rule 6 of this forum. Check the rules here.

Anyways, a few pointers. To get the individual fields from the file use the cut command. Check the man page for details. You can do the math using the ksh builtins or expr if you are going to be using sh/csh. I am sorry, but I won't be getting any more specific.
Closed Thread

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 04:58 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