Search Results

Search: Posts Made By: maya3
842
Posted By maya3
Matching information from different files
I have a dataset with coordinates of certain points with their names.

file1:

AAA 5 7
BBB 7 2
CCC 4 4
DDD 4 4
EEE 8 9
FFF 9 9
GGG 4 9
HHH 32 1
III 7 6
JJJ 12 4
KKK 12 3
MMM 15 3The...
6,381
Posted By maya3
Thank you, this works now. I think I might have...
Thank you, this works now. I think I might have accidentally added the whitespace later on while I was trying to find a solution to remove 0 with text editor's options. It works now with your command...
6,381
Posted By maya3
Thank you for the answers. It seemed that I...
Thank you for the answers.

It seemed that I had \r\n at the end of the line and I replaced it with \n but the outputs are still the same.
This is what I get when I write
head file | od -bc(the...
6,381
Posted By maya3
Remove lines ending with a certain character
I have a file of a content like this:

abc_bla -def 800
abc_bla -def 802
abc_bla -def 804
abc_bla -def 806
abc_bla -def 808
abc_bla -def 810
abc_bla -def 812
abc_bla -def 814
...
abc_bla...
1,254
Posted By maya3
Cshell if clause indentation
I would like to know if indentation is relevant for Cshell scripts.
I wrote my code like this:


if ((-e file1) && (-e file2)) then

cat file1 > file10
cat file2 > file20

endifUsually I...
2,233
Posted By maya3
I thought these were all double (they're output...
I thought these were all double (they're output from C)
2,233
Posted By maya3
I wrote round numbers for simplicity. So the file...
I wrote round numbers for simplicity. So the file is actually several thousand lines/columns long and these are example lines. Yes in this case the precision of the more precise entry should be...
2,233
Posted By maya3
Does the fact that I am printing it as string...
Does the fact that I am printing it as string (printf and %s) make any problems with precision or format for later use? The entries in file1 and file2 can be either float or decimal and the precision...
2,233
Posted By maya3
Yes it does work, sorry, I've typed i<NF/2...
Yes it does work, sorry, I've typed i<NF/2 instead of i<=NF/2.

May I ask, what does

(i==NF/2)?ORS:OFS
mean? I assume it means that when i is equal to half of the number of records it goes...
2,233
Posted By maya3
I've now tried this but it also doesn't add up...
I've now tried this but it also doesn't add up the values properly nor print them in the right format. I suppose my approach isn't the way to go, it was simply the only thing I could think of doing....
2,233
Posted By maya3
Adding columns from 2 files with variable number of columns
I have two files, file1 and file2 who have identical number of rows and columns. However, the script is supposed to be used for for different files and I cannot know the format in advance. Also, the...
2,023
Posted By maya3
@wbport thanks for the explanation, but this...
@wbport thanks for the explanation, but this solution would require more data handling so I'll go with the other one

@RudiC, this works but may I ask if I understood the code well:


NR == 1 ...
2,023
Posted By maya3
Sorry I don't understand what do you mean by c...
Sorry I don't understand what do you mean by c lines and lines containing a or d?


Also, this code gave me the which has in its second line two numbers separated by comma which are in neither of...
2,023
Posted By maya3
thanks I've tried that now but I still have the...
thanks I've tried that now but I still have the same problem as when using the code from my second post.
With the files containing different numbers as in my first post, I get empty lines as first...
2,023
Posted By maya3
I tried with turning file1 into a column file...
I tried with turning file1 into a column file with:



tr ' ' '\n' < file1 | awk '{print $0}' > file1_new

and then solving it by working with columns



awk '{k = $1} NR==FNR{a[k]; next}...
2,023
Posted By maya3
Comparing two one-line files and selecting what does not match
I have two files. One is consisting of one line, with data separated by spaces and each number appearing only once.
The other is consisting of one column and multiple lines which can have some...
Showing results 1 to 16 of 16

 
All times are GMT -4. The time now is 04:47 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy