Sponsored Content
Full Discussion: Looping through input/output
Top Forums UNIX for Beginners Questions & Answers Looping through input/output Post 302979867 by zajtat on Saturday 20th of August 2016 09:01:16 AM
Old 08-20-2016
Each of the files consisted of 7 columns: the first three columns are the same in each file and the other 4 columns are the actual data (but we need to use only the last three of those). The merging would mean to keep the first three columns and then add the the last three columns of each file matched by the first column. For example, infile1 could be

Code:
a b c 1 2 3 4
d e f 5 6 7 8
g h j 9 10 11 12

infile2 could be:

Code:
a b c 11 3 4 5 
g h j 9 8 7 6
d e f 1 2 3 4

infile3 could be

Code:
d e f 2 3 4 5
a b c 5 6 7 8
g h j 9 10 11 12



then the after the merging step1, the outfile1 would look like like this:

Code:
a b c 1 2 3 4 3 4 5
d e f 5 6 7 8 2 3 4
g h j 9 10 11 12 8 7 6

then after adding infile3, the outfile2 would look like this:

Code:
a b c 1 2 3 4 3 4 5 6 7 8
d e f 5 6 7 8 2 3 4 3 4 5
g h j 9 10 11 12 8 7 6 10 11 12

I hope this clears things up.

Many thanks!

Last edited by vbe; 08-20-2016 at 10:54 AM.. Reason: code tags please not icode
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Using Output from one command as input to another

This site has been very helpful thus far.. I thank you all in advance for sharing the knowledge. Let me get to it. I am trying to write a very small script to take away from the boredom of doing the same thing over and over. Everynow and again I have to get the hex value of a file using a... (2 Replies)
Discussion started by: BkontheShell718
2 Replies

2. UNIX for Advanced & Expert Users

input/Output settings

How can we view all the input/output settings of unix environment for a session (6 Replies)
Discussion started by: paritoshc
6 Replies

3. Shell Programming and Scripting

input -output file

Hi, I am having an Input file .which is having a list of names. comapring with our database , needs to write the out put in file called output.txt , format should be name--> country--->phone number could you please help me.. thanks in advance (7 Replies)
Discussion started by: hegdeshashi
7 Replies

4. Shell Programming and Scripting

perl: looping through the output of a 'system' command

Hi there could anybody point me in the right direction when it comes to looping through the output of a system command in perl (i.e. df -k) doing a test against each line to see if it matches? for example if i have a df -k output like this and I wanted to grab the lines that matched "sda" or... (3 Replies)
Discussion started by: rethink
3 Replies

5. Shell Programming and Scripting

Dynamic output file generation using a input text file with predefined output format

Hi, I have two files , one file with data file with attributes that need to be sent to another file to generate a predefined format. Example: File.txt AP|{SSHA}VEEg42CNCghUnGhCVg== APVG3|{SSHA}XK|"password" AP3|{SSHA}XK|"This is test" .... etc --------- test.sh has... (1 Reply)
Discussion started by: hudson03051nh
1 Replies

6. Solaris

SVM Solaris 8 Problem. Metastat output looping

Hi friends, I'm newbie to SVM. Just wanna try installed it on one of our server (to do mirroring for disk0 and disk1) but i think im lost until now. :( the steps i've taken is as below:- 1.prtvtoc /dev/rdsk/c1t0d0s2 | fmthard -s - /dev/rdsk/c1t1d0s2 2.metadb -a -c 3 -f c1t0d0s7... (3 Replies)
Discussion started by: kronenose
3 Replies

7. Shell Programming and Scripting

Looping through for user input

Legends, I want to remain in the script until user passes the correct name. I had tried the below code; but it didn't work out. Please help echo "\nPlease enter the source system: \c" while read SYSTEM_NAME do if ]; then echo "\nMaking $SYSTEM_NAME as source system for particular... (5 Replies)
Discussion started by: sdosanjh
5 Replies

8. Shell Programming and Scripting

looping and saving output of each line separately

I have been trying this program for a long time. I am trying to read a file named "odon" line by line; read the first line, send it to do a command saved in a file "perm", once the first line has finished going through the content of the file perm, the result is saved with the number of the line.... (17 Replies)
Discussion started by: iconig
17 Replies

9. UNIX for Dummies Questions & Answers

Looping through the contents of array for output name

Hi all, I am trying to loop through the string contents of an array, to add it during the saving of the output files. I am trying this code to print each column and save it to unique file name, but it doesn't work. Thanks for any help. fnam=(japan usa uk) alldata.dat contained sample data... (1 Reply)
Discussion started by: ida1215
1 Replies

10. Shell Programming and Scripting

Looping over output of 'ls'

Hi, I have some output from 'ls' command and I want to loop over the output in a bash script. What would be a good way to go about it? For example, if the output of the ls command gives me 'prefix1 prefix2 prefix3', how can I set a loop that will iterate over these? many thanks! (5 Replies)
Discussion started by: pc2001
5 Replies
MAKECSD(1)						  The Canonical Csound Reference						MAKECSD(1)

NAME
makecsd - Creates a CSD file from the specified input files. . DESCRIPTION
Creates a CSD file from the specified input files. The first input file that has a .orc extension (case is not significant) is put to the <CsInstruments> section, and the first input file that has a .sco extension becomes <CsScore>. Any remaining files are Base64 encoded and added as <CsFileB> tags. An empty <CsOptions> section is always added. Some text filtering is performed on the orchestra and score file: o newlines are converted to the native format of the system on which makecsd is being run. o blank lines are removed from the beginning and end of files. o any trailing whitespace is removed from the end of lines. o optionally, tabs can be expanded to spaces with an user specified tabstop size. SYNTAX
makecsd [OPTIONS ... ] infile1 [ infile2 [ ... ]] INITIALIZATION
Flags: o - t n = expand tabs to spaces using tabstop size n (default: disabled). This applies only to the orchestra and score file. o - w n = set Base64 line width to n (default: 72). Note: the orchestra and score are not wrapped. o - o fname = output file name (default: stdout) EXAMPLES
makecsd -t 6 -w 78 -o file.csd file.mid file.orc file.sco sample.aif This creates a CSD from file.orc and file.sco (tabs are expanded to spaces assuming a tabstop size of 6 characters), and file.mid and sample.aif are added as <CsFileB> tags containing Base64 encoded data with a line width of 78 characters. The output file is file.csd. CREDITS
Author: Istvan Varga Jan 2003 AUTHORS
Barry Vercoe MIT Media Lab Author. Dan Ellis MIT Media Lab, Cambridge Massachussetts Author. COPYRIGHT
5.10 08/01/2011 MAKECSD(1)
All times are GMT -4. The time now is 02:11 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy