recoding/ converting numbers


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting recoding/ converting numbers
# 8  
Old 08-16-2012
Quote:
Originally Posted by raj_saini20
what the problem you are facing with my code
let me know.
i will try to rectify it.
for the input you have given its working.
I get errors like

Code:
Display all 509 possibilities? (y or n)
> A/&&$(j+1)~/NA/)
>
Display all 509 possibilities? (y or n)
> tf "NA "
>
Display all 509 possibilities? (y or n)
> tf a[ind]+a[ind1]" "
>
Display all 509 possibilities? (y or n)
> tf "\n"}' ${data}/ped.txt > ${data}/111.txt
awk: cmd. line:2: d]=0;
awk: cmd. line:2:  ^ syntax error
awk: cmd. line:4: d]=0;
awk: cmd. line:4:  ^ syntax error
awk: cmd. line:5: $6==0)
awk: cmd. line:5:      ^ syntax error
awk: cmd. line:7: d]="NA";
awk: cmd. line:7:  ^ syntax error
awk: cmd. line:9: d]=1;
awk: cmd. line:9:  ^ syntax error
awk: cmd. line:11: d]=0;
awk: cmd. line:11:  ^ syntax error
awk: cmd. line:13: d]="NA";
awk: cmd. line:13:  ^ syntax error
awk: cmd. line:15: d]=0;
awk: cmd. line:15:  ^ syntax error
awk: cmd. line:17: d]=1;
awk: cmd. line:17:  ^ syntax error
awk: cmd. line:22: d];
awk: cmd. line:22:  ^ syntax error
awk: cmd. line:23: d1];
awk: cmd. line:23:   ^ syntax error
awk: cmd. line:24: A/&&$(j+1)~/NA/)
awk: cmd. line:24:   ^ syntax error
awk: cmd. line:24: A/&&$(j+1)~/NA/)
awk: cmd. line:24:                ^ syntax error


Last edited by Franklin52; 08-16-2012 at 11:26 AM.. Reason: Please use code tags for data and code samples
# 9  
Old 08-17-2012
Are you using the code on same set of data you have provided or to other data.
if you are using another set of data then please provide me that data.

As i am getting the output as
Code:
id1 id1 1 1 0 1 2 0
id3 id3 0 0 1 1 2 0
id5 id5 0 0 0 0 NA 0

for this code on data given by you.
I had tested on HP-UX
# 10  
Old 08-17-2012
Try putting it in a file instead of pasting it into a terminal. It looks like it's trying to expand tabs in the text you're pasting.
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. UNIX for Beginners Questions & Answers

Decimal numbers and letters in the same collums: round numbers

Hi! I found and then adapt the code for my pipeline... awk -F"," -vOFS="," '{printf "%0.2f %0.f\n",$2,$4}' xxx > yyy I add -F"," -vOFS="," (for input and output as csv file) and I change the columns and the number of decimal... It works but I have also some problems... here my columns ... (7 Replies)
Discussion started by: echo manolis
7 Replies

2. Shell Programming and Scripting

Adding (as in arithmetic) to numbers in columns in file, and writing new file with new numbers

Hi again. Sorry for all the questions — I've tried to do all this myself but I'm just not good enough yet, and the help I've received so far from bartus11 has been absolutely invaluable. Hopefully this will be the last bit of file manipulation I need to do. I have a file which is formatted as... (4 Replies)
Discussion started by: crunchgargoyle
4 Replies

3. Shell Programming and Scripting

Recoding data in a matrix from an existing file

Hi, I was wondering if someone would be able to help with extrapolating information from a file and filling an existing matrix with that information. I have made a matrix like this (file 1): A B C D 1 2 3 4 I have another file with data like this (file 2): 1 A 1 C 3 C 4 B... (1 Reply)
Discussion started by: hubleo
1 Replies

4. Shell Programming and Scripting

Simple perl help - converting numbers

Hi friends, I'm very new to perl and got some requirement. I've input numbers which has size of 17 characters like below: -22500.0000000000 58750.00000000000 4944.000000000000 -900.000000000000 272.0000000000000 I need to convert these numbers from negative to positive and positive... (4 Replies)
Discussion started by: ganapati
4 Replies

5. UNIX for Dummies Questions & Answers

Print numbers and associated text belonging to an interval of numbers

##### (0 Replies)
Discussion started by: lucasvs
0 Replies

6. Shell Programming and Scripting

the smallest number from 90% of highest numbers from all numbers in file

Hello All, I am having problem to find what is the smallest number from 90% of highest numbers from all numbers in file. I am having file with thousands of lines and hundreds of columns. I am familiar mainly with bash but I am open to whatever suggestion witch will lead to the solutions. If I... (11 Replies)
Discussion started by: Apfik
11 Replies

7. UNIX for Dummies Questions & Answers

Replace US numbers with European numbers

hey, I have a file with numbers in US notation (1,000,000.00) as well as european notation (1.000.000,00) i want all the numbers to be in european notation. the numbers are in a text file, so to prevent that the regex also changes the commas in a sentence/text i thought of: sed 's/,/\./'... (2 Replies)
Discussion started by: FOBoy
2 Replies

8. Shell Programming and Scripting

recoding data points using SED??

Hello all, I have a data file that needs some serious work...I have no idea how to implement the changes that are needed! The file is a genotypic file with >64,000 columns representing genetic markers, a header line, and >1100 rows that looks like this: ID 1 2 3 4 ... (7 Replies)
Discussion started by: doobedoo
7 Replies

9. Shell Programming and Scripting

read numbers from file and output which numbers belongs to which range

Howdy experts, We have some ranges of number which belongs to particual group as below. GroupNo StartRange EndRange Group0125 935300 935399 Group2006 935400 935476 937430 937459 Group0324 935477 935549 ... (6 Replies)
Discussion started by: thepurple
6 Replies

10. UNIX for Dummies Questions & Answers

seperating records with numbers from a set of numbers

I have two files one (numbers file)contains the numbers(approximately 30000) and the other file(record file) contains the records(approximately 40000)which may or may not contain the numbers from that file. I want to seperate the records which has the field 1=(any of the number from numbers... (15 Replies)
Discussion started by: Shiv@jad
15 Replies
Login or Register to Ask a Question