program in loop.


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting program in loop.
# 1  
Old 10-23-2009
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  
Old 10-23-2009
What is the algorithm to transform the input to the output?

What do you have to do to it?
# 3  
Old 10-23-2009
Hi.

Is there any chance you might tell us where 0000002, etc. might come from?
# 4  
Old 10-23-2009
Pls read my earlier posting on this.
https://www.unix.com/shell-programmin...d-line-do.html

Quote:
Originally Posted by scottn
Hi.

Is there any chance you might tell us where 0000002, etc. might come from?
# 5  
Old 10-23-2009
Sorry. I didn't realise that this was a double post!!
# 6  
Old 10-23-2009
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.
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Perl program get a response before the program quits

I created a program, so a kid can practice there math on it. It dispenses varies math problems and the kid must input an answer. I also want it to grade the work they have done, but I can't find the best place for it to print out the grade. I have: if ( $response =~ m/^/ ) { $user_wants_to_quit... (1 Reply)
Discussion started by: germany1517
1 Replies

2. UNIX for Dummies Questions & Answers

Using Shell Script To Loop Program Through Multiple Text Files

Hello, So I have approximately 300 files of raw data (.txt) files that I am using to perform statistical analysis. I have been able to construct a Fortran program that is able to perform my statistical analysis on a file by file basis. However, I now want to be able to loop program through... (19 Replies)
Discussion started by: Jimmyd24
19 Replies

3. Shell Programming and Scripting

For loop to run external program

Hi, I was hoping for help with a for loop to run a program (vina) repeatedly using all the files in a folder as input. Currently my code looks like this: #!/bin/bash FILES=/home/afalk/Desktop/battest/*.pdbqt for f in $FILES do vina --config /home/afalk/Desktop/A.txt --ligand "$f".pdbqt done... (5 Replies)
Discussion started by: oldmanwinter
5 Replies

4. Homework & Coursework Questions

Calling compiled C program with Perl program

Long story short: I'm working inside of a Unix SSH under a bash shell. I have to code a C program that generates a random number. Then I have to call the compiled C program with a Perl program to run the C program 20 times and put all the generated random #s into a text file, then print that text... (1 Reply)
Discussion started by: jdkirby
1 Replies

5. Shell Programming and Scripting

Running binnary program in a loop

I am using a very simple script (MUS) to process some files where the input file for the binary application I am running has to be named infile. So I have this: #!/bin/bash for i in {1..n} do mv block${i} infile done ./dnadist <<EOF D Y EOF However, I want to use dnadist inside the... (3 Replies)
Discussion started by: Xterra
3 Replies

6. Shell Programming and Scripting

Invoking a program in a loop

In the following script, I wish to invoke a compiled C++ program, consimv4 and pass it some command line arguments through the shell script's command line arguments and variables. But for some reason, when I run the script, I just return to the shell prompt and nothing happens. For the life of me,... (7 Replies)
Discussion started by: msaqib
7 Replies

7. Programming

Python program faster than C++ program.

I wrote a simple program that generates a random word 10,000,000 times. I wrote it in python, then in C++ and compared the two completion times. The python script was faster! Is that normal? Why would the python script be faster? I was under the impression that C++ was faster. What are some of... (2 Replies)
Discussion started by: cbreiny
2 Replies

8. UNIX for Dummies Questions & Answers

Script to open program and send/execute command in program

Hi, i want to write a script that executes a program (exec?) . this program then requires a filename as input. how do i give it this input in the script so the program will be complete run and close by the script. e.g. exec prog.exe program then asks for filename "enter filename:"... (1 Reply)
Discussion started by: tuathan
1 Replies

9. Shell Programming and Scripting

redirect variable to same program at next loop

Hi all, I don't know how to redirect a variable in this case: while true do ./ready_data ... done ready_data should read a file looking for an ID, if this doesn't exist then add the last ID seen into the first line. When ID exists there is no problem, but when ID doesn't... (0 Replies)
Discussion started by: csecnarf
0 Replies

10. UNIX for Dummies Questions & Answers

While loop program

I have a data file contain the following information: 1 2 3 4 5 10 11 30 90 300 9 29 and on and on I need to create a program with give me the following data format: Jon A (2 Replies)
Discussion started by: bobo
2 Replies
Login or Register to Ask a Question