02-16-2010
there are 2 inputs. One file contains the integers I want in 1 column, the other one is ordered into 4 rows with different numbers of columns (I need to switch the numbers from the single-column file into their respective counterparts in the 4-row different-number-of-columns file)
one-column file input:
4.5454
6.46643
9.23423
15.42362
141.43535
151.35235
193.353
multiple column file input:
6.5432 8.54353 14.3535 16.34324
21.5235 45.4363 75.454
output would look like:
4.5454 6.46643 9.23423 15.42362
141.43535 151.35235 193.353
(same column/row structure as the 2nd file but with the numbers from the 1st file)
10 More Discussions You Might Find Interesting
1. Shell Programming and Scripting
Hi All,
I have a table with 10 columns. Some columns(2nd,4th,5th,7th,8th and 10th) are Not Null columns. I'll get a tab-delimited file and want to check col by col and generate seperate error code for each col eg:102 if 2nd col value is NULL and 104 if 4th col value is NULL so on... I am a... (7 Replies)
Discussion started by: Mandab
7 Replies
2. UNIX for Dummies Questions & Answers
I have a program which gives me the output as a single column with hundreds of rows like:
213
314
324
324
123
I want to be able to create a new file from this file which allows me to set the number of rows and columns in the new file, i.e. for this example, if I specify 3 rows and 2... (5 Replies)
Discussion started by: ashton_smith
5 Replies
3. Shell Programming and Scripting
Hi,
I have a small requirement in chainging the rows to columns. The below example.txt contains info as shown
Name:Person1
Age:30
Name:Person2
Age:40
Name:Person3
Age:50
I want to make it displayed as hown below
Name:Person1 Age:30
Name:person2 Age:40
Name:Person3 Age:50
I... (4 Replies)
Discussion started by: oracle123
4 Replies
4. Shell Programming and Scripting
Hi, Iam new to unix. I have one input file .
Input file :
ID1~Name1~Place1
ID2~Name2~Place2
ID3~Name3~Place3
I need output such that only first column should change to fixed width column of 15 characters of length.
Output File:
ID1<<12 spaces>>Name1~Place1
ID2<<12... (5 Replies)
Discussion started by: manneni prakash
5 Replies
5. Shell Programming and Scripting
i have a file a.txt contents as 1,2,3,4,......etc...in a single line, i want to write to another file in rows as
1
2
3
4
5
can u help?
i do not know the length of a.txt (4 Replies)
Discussion started by: pravfraz
4 Replies
6. Shell Programming and Scripting
Hello All,
Please help me with this file.
My input file (Tab separated) is like:
Abc-01 pc1 -0.69
Abc-01 E2cR 0.459666666666667
Abc-01 5ez.2 1.2265625
Xyz-01 pc1 -0.153
Xyz-01 E2cR 1.7358
Xyz-01 5ez.2 2.0254
Ced-02 pc1 -0.5714
Ced-02 ... (7 Replies)
Discussion started by: mira
7 Replies
7. UNIX for Dummies Questions & Answers
I have 2 files,
file01= 7 columns, row unknown (but few)
file02= 7 columns, row unknown (but many)
now I want to create an output with the first field that is shared in both of them and then subtract the results from the rest of the fields and print there
e.g.
file 01
James|0|50|25|10|50|30... (1 Reply)
Discussion started by: A-V
1 Replies
8. Shell Programming and Scripting
Hi Friends,
I have come across some files where some of the columns don not have data.
Key, Data1,Data2,Data3,Data4,Data5
A,5,6,,10,,
A,3,4,,3,,
B,1,,4,5,,
B,2,,3,4,,
If we see the above data on Data5 column do not have any row got filled. So remove only that column(Here Data5) and... (4 Replies)
Discussion started by: ks_reddy
4 Replies
9. Shell Programming and Scripting
input:
chr1 1 2 3
chr1 1 2 4
chr1 2 4 5
chr2 3 6 9
chr2 3 6 10
Code:
awk '{a+=$4}END{for (i in a) print i,a}' input
Output:
chr112 7
chr236 19
chr124 5
Desired output:
chr1 1 2 7
chr2 3 6 19
chr1 2 4 5 (1 Reply)
Discussion started by: jacobs.smith
1 Replies
10. UNIX for Advanced & Expert Users
HI,
My Input file data is
dn:adcfgeneral
id:13343
Name:xxxxxx
Password:iutyerwuitywue wpuwt
tuiytruityrutyrwtyrwp
dn:cdferwjyyyy
id:3875
Name:yyyy
Password :hgfdsjkfhdsfkdlshf
dshfkldshfdklsfh
interset:uiuiufj
My output should be
... (6 Replies)
Discussion started by: dineshaila
6 Replies
PSC(1) General Commands Manual PSC(1)
NAME
psc - prepare sc files
SYNOPSIS
psc [-fLkrSPv] [-s cell] [-R n] [-C n] [-n n] [-d c]
DESCRIPTION
Psc is used to prepare data for input to the spreadsheet calculator sc(1). It accepts normal ascii data on standard input. Standard out-
put is a sc file. With no options, psc starts the spreadsheet in cell A0. Strings are right justified. All data on a line is entered on
the same row; new input lines cause the output row number to increment by one. The default delimiters are tab and space. The column for-
mats are set to one larger than the number of columns required to hold the largest value in the column.
OPTIONS
-f Omit column width calculations. This option is for preparing data to be merged with an existing spreadsheet. If the option is not
specified, the column widths calculated for the data read by psc will override those already set in the existing spreadsheet.
-L Left justify strings.
-k Keep all delimiters. This option causes the output cell to change on each new delimiter encountered in the input stream. The
default action is to condense multiple delimiters to one, so that the cell only changes once per input data item.
-r Output the data by row first then column. For input consisting of a single column, this option will result in output of one row
with multiple columns instead of a single column spreadsheet.
-s cell
Start the top left corner of the spreadsheet in cell. For example, -s B33 will arrange the output data so that the spreadsheet
starts in column B, row 33.
-R n Increment by n on each new output row.
-C n Increment by n on each new output column.
-n n Output n rows before advancing to the next column. This option is used when the input is arranged in a single column and the
spreadsheet is to have multiple columns, each of which is to be length n.
-d c Use the single character c as the delimiter between input fields.
-P Plain numbers only. A field is a number only when there is no imbedded [-+eE].
-S All numbers are strings.
-v Print the version of psc
SEE ALSO
sc(1)
AUTHOR
Robert Bond
PSC 7.16 19 September 2002 PSC(1)