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
Using variables created sequentially in a loop while still inside of the loop [bash] DeCoTwc Shell Programming and Scripting 2 06-23-2009 05:59 PM
Script to open program and send/execute command in program tuathan UNIX for Dummies Questions & Answers 1 11-19-2008 09:59 PM
A program to trace execution of another program jiten_hegde High Level Programming 3 08-19-2008 06:26 AM
redirect variable to same program at next loop csecnarf Shell Programming and Scripting 0 06-16-2008 07:44 AM
While loop program bobo UNIX for Dummies Questions & Answers 2 07-26-2006 04:07 AM

Closed Thread
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
  #1 (permalink)  
Old 10-23-2009
kshuser kshuser is offline
Registered User
  
 

Join Date: Oct 2009
Posts: 30
program in loop.

eg: sample.dat

21111111110000652 B86860003OLFXXX0000001_20081227
21111111110000652 B86860003ODL-SP0000002_20081227
21111111110000652-B94030001ODL-CH0000003_20081227
22222222220000653-B94030001OLFXXX0000011_20081227
23333333330000654-E71060001OLFXXX0000012_20081227
24444444440000655 E71060002OLFXXX0000014_20081227
24444444440000655 E71060002ODL-SP0000015_20081227
.....
.....

I Want to write a program in ksh script in such a way (while read line do) that the out txt file should look like below

outfile.txt

21111111110000652 B86860003OLFXXX000000120081227 0000002 0000003
22222222220000653-B94030001OLFXXX000001120081227
23333333330000654-E71060001OLFXXX000001220081227
24444444440000655 E71060002OLFXXX000001420081227 0000015

thx
  #2 (permalink)  
Old 10-23-2009
cfajohnson's Avatar
cfajohnson cfajohnson is offline Forum Advisor  
Shell programmer, author
  
 

Join Date: Mar 2007
Location: Toronto, Canada
Posts: 2,380
What is the algorithm to transform the input to the output?

What do you have to do to it?
  #3 (permalink)  
Old 10-23-2009
scottn scottn is offline Forum Advisor  
VIP Member
  
 

Join Date: Jun 2009
Location: Zürich, CH
Posts: 1,134
Hi.

Is there any chance you might tell us where 0000002, etc. might come from?
  #4 (permalink)  
Old 10-23-2009
kshuser kshuser is offline
Registered User
  
 

Join Date: Oct 2009
Posts: 30
Pls read my earlier posting on this.
while read line do

Quote:
Originally Posted by scottn View Post
Hi.

Is there any chance you might tell us where 0000002, etc. might come from?
  #5 (permalink)  
Old 10-23-2009
scottn scottn is offline Forum Advisor  
VIP Member
  
 

Join Date: Jun 2009
Location: Zürich, CH
Posts: 1,134
Sorry. I didn't realise that this was a double post!!
  #6 (permalink)  
Old 10-23-2009
vgersh99's Avatar
vgersh99 vgersh99 is offline Forum Staff  
Moderator
  
 

Join Date: Feb 2005
Location: Boston, MA
Posts: 5,131
Bumping up posts or double posting is not permitted in these forums.

Please read the rules, which you agreed to when you registered, if you have not already done so.

You may receive an infraction for this. If so, don't worry, just try to follow the rules more carefully. The infraction will expire in the near future

Thank You.

The UNIX and Linux Forums.
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 06:06 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